Skip to content

Commit

Permalink
OP-320: CR Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Jun 21, 2024
1 parent 0319049 commit d997864
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 73 deletions.
12 changes: 9 additions & 3 deletions spec/Assigner/CollectionsAssignerSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
*/

declare(strict_types=1);

namespace spec\BitBag\SyliusCmsPlugin\Assigner;
Expand Down Expand Up @@ -30,9 +36,9 @@ public function it_implements_collections_assigner_interface(): void

public function it_assigns_collections(
CollectionRepositoryInterface $collectionRepository,
CollectionInterface $aboutCollection,
CollectionInterface $blogCollection,
CollectionableInterface $collectionsAware
CollectionInterface $aboutCollection,
CollectionInterface $blogCollection,
CollectionableInterface $collectionsAware
): void
{
$collectionRepository->findOneBy(['code' => 'about'])->willReturn($aboutCollection);
Expand Down
29 changes: 15 additions & 14 deletions spec/Importer/BlockImporterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
final class BlockImporterSpec extends ObjectBehavior
{
public function let(
ResourceResolverInterface $blockResourceResolver,
LocaleContextInterface $localeContext,
ResourceResolverInterface $blockResourceResolver,
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
BlockRepositoryInterface $blockRepository
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
BlockRepositoryInterface $blockRepository
) {
$this->beConstructedWith(
$blockResourceResolver,
Expand All @@ -50,15 +50,16 @@ public function it_is_initializable()
}

public function it_imports_block(
ResourceResolverInterface $blockResourceResolver,
LocaleContextInterface $localeContext,
ResourceResolverInterface $blockResourceResolver,
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
BlockRepositoryInterface $blockRepository,
BlockInterface $block
) {
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
BlockRepositoryInterface $blockRepository,
BlockInterface $block
)
{
$row = ['name_pl' => 'name', 'content_pl' => 'content', 'link_pl' => 'link', 'code' => 'block_code'];

$blockResourceResolver->getResource('block_code')->willReturn($block);
Expand Down
25 changes: 13 additions & 12 deletions spec/Importer/MediaImporterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
final class MediaImporterSpec extends ObjectBehavior
{
public function let(
ResourceResolverInterface $mediaResourceResolver,
LocaleContextInterface $localeContext,
ResourceResolverInterface $mediaResourceResolver,
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
MediaRepositoryInterface $mediaRepository
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
MediaRepositoryInterface $mediaRepository
) {
$this->beConstructedWith(
$mediaResourceResolver,
Expand All @@ -47,14 +47,15 @@ public function it_is_initializable()
}

public function it_imports_media(
ResourceResolverInterface $mediaResourceResolver,
LocaleContextInterface $localeContext,
ResourceResolverInterface $mediaResourceResolver,
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
MediaRepositoryInterface $mediaRepository,
MediaInterface $media
) {
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
MediaRepositoryInterface $mediaRepository,
MediaInterface $media
)
{
$row = ['name_pl' => 'name', 'content_pl' => 'content', 'alt_pl' => 'alt', 'code' => 'media_code'];

$mediaResourceResolver->getResource('media_code')->willReturn($media);
Expand Down
35 changes: 18 additions & 17 deletions spec/Importer/PageImporterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
final class PageImporterSpec extends ObjectBehavior
{
public function let(
ResourceResolverInterface $pageResourceResolver,
LocaleContextInterface $localeContext,
ImageDownloaderInterface $imageDownloader,
FactoryInterface $mediaFactory,
MediaProviderResolverInterface $mediaProviderResolver,
ResourceResolverInterface $pageResourceResolver,
LocaleContextInterface $localeContext,
ImageDownloaderInterface $imageDownloader,
FactoryInterface $mediaFactory,
MediaProviderResolverInterface $mediaProviderResolver,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
EntityManagerInterface $entityManager
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
EntityManagerInterface $entityManager
) {
$this->beConstructedWith(
$pageResourceResolver,
Expand All @@ -59,15 +59,16 @@ public function it_is_initializable()
}

public function it_imports_page_no_url(
ResourceResolverInterface $pageResourceResolver,
LocaleContextInterface $localeContext,
ResourceResolverInterface $pageResourceResolver,
LocaleContextInterface $localeContext,
ImporterCollectionsResolverInterface $importerCollectionsResolver,
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
EntityManagerInterface $entityManager,
PageInterface $page,
) {
ImporterChannelsResolverInterface $importerChannelsResolver,
ImporterProductsResolverInterface $importerProductsResolver,
ValidatorInterface $validator,
EntityManagerInterface $entityManager,
PageInterface $page,
)
{
$row = [
'code' => 'page_code',
'slug_pl' => 'slug',
Expand Down
4 changes: 2 additions & 2 deletions spec/Resolver/ImporterCollectionsResolverSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function it_is_initializable()

public function it_resolves_collections_for_collectionable_entity(
CollectionsAssignerInterface $collectionsAssigner,
CollectionableInterface $collectionable
CollectionableInterface $collectionable
) {
$collectionsRow = 'collection1, collection2, collection3';
$collectionsCodes = ['collection1', 'collection2', 'collection3'];
Expand All @@ -42,7 +42,7 @@ public function it_resolves_collections_for_collectionable_entity(

public function it_skips_resolution_when_collections_row_is_null(
CollectionsAssignerInterface $collectionsAssigner,
CollectionableInterface $collectionable
CollectionableInterface $collectionable
)
{
$collectionsRow = null;
Expand Down
28 changes: 14 additions & 14 deletions spec/Twig/Runtime/RenderProductPagesRuntimeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function it_implements_render_product_pages_runtime_interface(): void
}

public function it_renders_product_pages(
ChannelContextInterface $channelContext,
ProductInterface $product,
ChannelInterface $channel,
PageRepositoryInterface $pageRepository,
PageInterface $page,
CollectionInterface $collection,
Environment $templatingEngine,
ChannelContextInterface $channelContext,
ProductInterface $product,
ChannelInterface $channel,
PageRepositoryInterface $pageRepository,
PageInterface $page,
CollectionInterface $collection,
Environment $templatingEngine,
CollectionsSorterInterface $collectionsSorter
): void {
$channel->getCode()->willReturn('WEB');
Expand All @@ -68,13 +68,13 @@ public function it_renders_product_pages(
}

public function it_renders_product_pages_with_collections(
ChannelContextInterface $channelContext,
ProductInterface $product,
ChannelInterface $channel,
PageRepositoryInterface $pageRepository,
PageInterface $page,
CollectionInterface $collection,
Environment $templatingEngine,
ChannelContextInterface $channelContext,
ProductInterface $product,
ChannelInterface $channel,
PageRepositoryInterface $pageRepository,
PageInterface $page,
CollectionInterface $collection,
Environment $templatingEngine,
CollectionsSorterInterface $collectionsSorter
): void {
$channel->getCode()->willReturn('WEB');
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class Block implements BlockInterface
{
use ToggleableTrait;
use CollectionableTrait;
use CollectibleTrait;
use ProductsAwareTrait;
use TaxonAwareTrait;
use ChannelsAwareTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

trait CollectionableTrait
trait CollectibleTrait
{
protected Collection $collections;

Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

class Collection implements CollectionInterface
{
use PageableTrait;
use PagesCollectionTrait;
use BlockableTrait;
use MediableTrait;
use MediaCollectionTrait;
use TranslatableTrait {
__construct as private initializeTranslationsCollection;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
interface CollectionInterface extends
ResourceInterface,
TranslatableInterface,
PageableInterface,
PagesCollectionInterface,
BlockableInterface,
MediableInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Media implements MediaInterface
{
use ToggleableTrait;
use CollectionableTrait;
use CollectibleTrait;
use ProductsAwareTrait;
use ChannelsAwareTrait;
use TranslatableTrait {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

trait MediableTrait
trait MediaCollectionTrait
{
protected Collection $media;

Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Page implements PageInterface
{
use ToggleableTrait;
use ProductsAwareTrait;
use CollectionableTrait;
use CollectibleTrait;
use TimestampableTrait;
use ChannelsAwareTrait;
use TranslatableTrait {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine\Common\Collections\Collection;

interface PageableInterface
interface PagesCollectionInterface
{
public function initializePagesCollection(): void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

trait PageableTrait
trait PagesCollectionTrait
{
protected Collection $pages;

Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Repository/CollectionRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use BitBag\SyliusCmsPlugin\Repository\CollectionRepositoryInterface;
use Doctrine\ORM\QueryBuilder;

class CollectionRepositoryTest extends JsonApiTestCase
final class CollectionRepositoryTest extends JsonApiTestCase
{
public function setUp(): void
{
Expand Down

0 comments on commit d997864

Please sign in to comment.