Skip to content

Commit

Permalink
[General] Present admin data in the store
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbager committed Nov 13, 2017
1 parent 90478e4 commit 32afeb3
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions spec/Twig/Extension/RenderBlockExtensionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function it_adds_warning_for_not_found_block(
\Twig_Environment $twigEnvironment
): void
{
$blockRepository->findEnabledByCode('bitbag')->willReturn(null);
$blockRepository->findOneEnabledByCode('bitbag')->willReturn(null);
$logger->warning('Block with "bitbag" code was not found in the database.')->shouldBeCalled();

$this->renderBlock($twigEnvironment, 'bitbag')->shouldReturn(null);
Expand All @@ -69,7 +69,7 @@ function it_renders_text_template_for_text_type(
\Twig_Environment $twigEnvironment
): void
{
$blockRepository->findEnabledByCode('bitbag')->willReturn($block);
$blockRepository->findOneEnabledByCode('bitbag')->willReturn($block);
$block->getType()->willReturn('text');
$twigEnvironment->render('@BitBagCmsPlugin/Shop/Block/textBlock.html.twig', ['block' => $block])->shouldBeCalled();

Expand All @@ -82,7 +82,7 @@ function it_renders_html_template_for_html_type(
\Twig_Environment $twigEnvironment
): void
{
$blockRepository->findEnabledByCode('bitbag')->willReturn($block);
$blockRepository->findOneEnabledByCode('bitbag')->willReturn($block);
$block->getType()->willReturn('html');
$twigEnvironment->render('@BitBagCmsPlugin/Shop/Block/htmlBlock.html.twig', ['block' => $block])->shouldBeCalled();

Expand All @@ -95,7 +95,7 @@ function it_renders_image_template_for_image_type(
\Twig_Environment $twigEnvironment
): void
{
$blockRepository->findEnabledByCode('bitbag')->willReturn($block);
$blockRepository->findOneEnabledByCode('bitbag')->willReturn($block);
$block->getType()->willReturn('image');
$twigEnvironment->render('@BitBagCmsPlugin/Shop/Block/imageBlock.html.twig', ['block' => $block])->shouldBeCalled();

Expand Down
4 changes: 2 additions & 2 deletions spec/Twig/Extension/RenderPageLinkByCodeExtensionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function it_renders_page_link(
\Twig_Environment $twigEnvironment
): void
{
$pageRepository->findEnabledByCode('bitbag')->willReturn($page);
$pageRepository->findOneEnabledByCode('bitbag')->willReturn($page);
$twigEnvironment->render('BitBagCmsPlugin:Shop:Page:_link.html.twig', ['page' => $page])->shouldBeCalled();

$this->renderPageLinkByCode($twigEnvironment, 'bitbag');
Expand All @@ -69,7 +69,7 @@ function it_adds_warning_for_not_found_page(
\Twig_Environment $twigEnvironment
): void
{
$pageRepository->findEnabledByCode('bitbag')->willReturn(null);
$pageRepository->findOneEnabledByCode('bitbag')->willReturn(null);
$logger->warning('Page with "bitbag" code was not found in the database.')->shouldBeCalled();

$this->renderPageLinkByCode($twigEnvironment, 'bitbag')->shouldReturn(null);
Expand Down
2 changes: 1 addition & 1 deletion src/Fixture/BlockFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void
->prototype('array')
->children()
->booleanNode('remove_existing')->defaultTrue()->end()
->integerNode('number')->defaultTrue()->end()
->integerNode('number')->defaultNull()->end()
->booleanNode('last_four_products')->defaultFalse()->end()
->scalarNode('type')->isRequired()->cannotBeEmpty()->end()
->booleanNode('enabled')->defaultTrue()->end()
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/BlockRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function createListQueryBuilder(string $localeCode): QueryBuilder
/**
* {@inheritdoc}
*/
public function findEnabledByCode(string $code): ?BlockInterface
public function findOneEnabledByCode(string $code): ?BlockInterface
{
return $this->createQueryBuilder('o')
->where('o.code = :code')
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/BlockRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function createListQueryBuilder(string $localeCode): QueryBuilder;
*
* @return null|BlockInterface
*/
public function findEnabledByCode(string $code): ?BlockInterface;
public function findOneEnabledByCode(string $code): ?BlockInterface;

/**
* @param string $sectionCode
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/FrequentlyAskedQuestionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function findEnabledOrderedByPosition(string $localeCode): ?array
/**
* {@inheritdoc}
*/
public function findEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface
public function findOneEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface
{
return $this->createQueryBuilder('o')
->where('o.code = :code')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ public function findEnabledOrderedByPosition(string $localeCode): ?array;
*
* @return null|FrequentlyAskedQuestionInterface
*/
public function findEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface;
public function findOneEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface;
}
2 changes: 1 addition & 1 deletion src/Resolver/BlockResourceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(BlockRepositoryInterface $blockRepository, LoggerInt
*/
public function findOrLog(string $code): ?BlockInterface
{
$block = $this->blockRepository->findEnabledByCode($code);
$block = $this->blockRepository->findOneEnabledByCode($code);

if (false === $block instanceof BlockInterface) {
$this->logger->warning(sprintf(
Expand Down

0 comments on commit 32afeb3

Please sign in to comment.