-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from BitBagCommerce/dev
Prepare 2.0.0 release
- Loading branch information
Showing
31 changed files
with
263 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace spec\BitBag\SyliusCmsPlugin\Assigner; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssigner; | ||
use BitBag\SyliusCmsPlugin\Assigner\ChannelsAssignerInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Channel\Model\ChannelsAwareInterface; | ||
use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; | ||
use Sylius\Component\Core\Model\ChannelInterface; | ||
|
||
final class ChannelsAssignerSpec extends ObjectBehavior | ||
{ | ||
function let(ChannelRepositoryInterface $channelRepository): void | ||
{ | ||
$this->beConstructedWith($channelRepository); | ||
} | ||
|
||
function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ChannelsAssigner::class); | ||
} | ||
|
||
function it_implements_channels_assigner_interface(): void | ||
{ | ||
$this->shouldHaveType(ChannelsAssignerInterface::class); | ||
} | ||
|
||
function it_assigns_channels( | ||
ChannelRepositoryInterface $channelRepository, | ||
ChannelInterface $webChannel, | ||
ChannelInterface $posChannel, | ||
ChannelsAwareInterface $channelsAware | ||
): void | ||
{ | ||
$channelRepository->findOneBy(['code' => 'web'])->willReturn($webChannel); | ||
$channelRepository->findOneBy(['code' => 'pos'])->willReturn($posChannel); | ||
|
||
$channelsAware->addChannel($webChannel)->shouldBeCalled(); | ||
$channelsAware->addChannel($posChannel)->shouldBeCalled(); | ||
|
||
$this->assign($channelsAware, ['web', 'pos']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace spec\BitBag\SyliusCmsPlugin\Assigner; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\ProductsAssigner; | ||
use BitBag\SyliusCmsPlugin\Assigner\ProductsAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\ProductsAwareInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Repository\ProductRepositoryInterface; | ||
use Sylius\Component\Core\Model\ProductInterface; | ||
|
||
final class ProductsAssignerSpec extends ObjectBehavior | ||
{ | ||
function let(ProductRepositoryInterface $productRepository): void | ||
{ | ||
$this->beConstructedWith($productRepository); | ||
} | ||
|
||
function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ProductsAssigner::class); | ||
} | ||
|
||
function it_implements_products_assigner_interface(): void | ||
{ | ||
$this->shouldHaveType(ProductsAssignerInterface::class); | ||
} | ||
|
||
function it_assigns_products( | ||
ProductRepositoryInterface $productRepository, | ||
ProductInterface $mugProduct, | ||
ProductInterface $tshirtProduct, | ||
ProductsAwareInterface $productsAware | ||
): void | ||
{ | ||
$productRepository->findOneBy(['code' => 'mug'])->willReturn($mugProduct); | ||
$productRepository->findOneBy(['code' => 't-shirt'])->willReturn($tshirtProduct); | ||
|
||
$productsAware->addProduct($mugProduct)->shouldBeCalled(); | ||
$productsAware->addProduct($tshirtProduct)->shouldBeCalled(); | ||
|
||
$this->assign($productsAware, ['mug', 't-shirt']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace spec\BitBag\SyliusCmsPlugin\Assigner; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\SectionsAssigner; | ||
use BitBag\SyliusCmsPlugin\Assigner\SectionsAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\SectionInterface; | ||
use BitBag\SyliusCmsPlugin\Repository\SectionRepositoryInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use BitBag\SyliusCmsPlugin\Entity\SectionableInterface; | ||
|
||
final class SectionsAssignerSpec extends ObjectBehavior | ||
{ | ||
function let(SectionRepositoryInterface $sectionRepository): void | ||
{ | ||
$this->beConstructedWith($sectionRepository); | ||
} | ||
|
||
function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(SectionsAssigner::class); | ||
} | ||
|
||
function it_implements_sections_assigner_interface(): void | ||
{ | ||
$this->shouldHaveType(SectionsAssignerInterface::class); | ||
} | ||
|
||
function it_assigns_sections( | ||
SectionRepositoryInterface $sectionRepository, | ||
SectionInterface $aboutSection, | ||
SectionInterface $blogSection, | ||
SectionableInterface $sectionsAware | ||
): void | ||
{ | ||
$sectionRepository->findOneBy(['code' => 'about'])->willReturn($aboutSection); | ||
$sectionRepository->findOneBy(['code' => 'blog'])->willReturn($blogSection); | ||
|
||
$sectionsAware->addSection($aboutSection)->shouldBeCalled(); | ||
$sectionsAware->addSection($blogSection)->shouldBeCalled(); | ||
|
||
$this->assign($sectionsAware, ['about', 'blog']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace spec\BitBag\SyliusCmsPlugin\Twig\Parser; | ||
|
||
use BitBag\SyliusCmsPlugin\Twig\Extension\RenderBlockExtension; | ||
use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParser; | ||
use BitBag\SyliusCmsPlugin\Twig\Parser\ContentParserInterface; | ||
use PhpSpec\ObjectBehavior; | ||
|
||
final class ContentParserSpec extends ObjectBehavior | ||
{ | ||
function let(\Twig_Environment $twigEnvironment): void | ||
{ | ||
$this->beConstructedWith($twigEnvironment, ['bitbag_cms_render_block']); | ||
} | ||
|
||
function it_is_initializable(): void | ||
{ | ||
$this->shouldHaveType(ContentParser::class); | ||
} | ||
|
||
function it_implements_content_parser_interface(): void | ||
{ | ||
$this->shouldHaveType(ContentParserInterface::class); | ||
} | ||
|
||
function it_parses_string_functions( | ||
\Twig_Environment $twigEnvironment, | ||
\Twig_Function $renderBlockFunction, | ||
RenderBlockExtension $renderBlockExtension | ||
): void | ||
{ | ||
$twigEnvironment->getFunctions()->willReturn([ | ||
'bitbag_cms_render_block' => $renderBlockFunction, | ||
]); | ||
$renderBlockFunction->getCallable()->willReturn([$renderBlockExtension, 'renderBlock']); | ||
|
||
$input = "Let's render! {{ bitbag_cms_render_block('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig') }}"; | ||
|
||
$renderBlockExtension->renderBlock('intro', '@BitBagSyliusCmsPlugin/Shop/Block/show.html.twig')->shouldBeCalled(); | ||
|
||
$this->parse($input); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.