-
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 #517 from BitBagCommerce/feature/OP-464
OP-464: Block and page import adjustments
- Loading branch information
Showing
28 changed files
with
630 additions
and
60 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
code,type,name_en_US,content_en_US,sections,channels,products,image_en_US,slug_en_US | ||
test4,image,Test,test,"blog, general",US_WEB,"010ba66b-adee-3d6e-9d63-67c44d686db1, 01d35db9-247d-3834-b300-20483d5e34e8",https://bitbag.shop/assets/web/images/header-logo.png,https://bitbag.shop/assets/web/images/header-logo.png | ||
code,name,enabled,collections,locales,channels,products,products_in_taxons,taxons | ||
test4,Block name,1,"blog,general",,FASHION_WEB,"000F_office_grey_jeans, 007M_black_elegance_jeans","caps, t_shirts",t_shirts |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
code,sections,channels,products,slug_en_US,name_en_US,image_en_US,meta_keywords_en_US,meta_description_en_US,content_en_US,breadcrumb_en_US,name_when_linked_en_US,description_when_linked_en_US | ||
aboutUS,,US_WEB,,about_us,About US,,About US,About US,"",,, | ||
code,name,enabled,collections,channels,slug_en_US,meta_title_en_US,meta_keywords_en_US,meta_description_en_US,slug_de_DE,meta_title_de_DE,meta_keywords_de_DE,meta_description_de_DE | ||
aboutUS,About US,1,,FASHION_WEB,about_us,Meta title en US,About US,About US,about_us,Meta title en DE,About US,About US |
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,53 @@ | ||
<?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; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\LocalesAssigner; | ||
use BitBag\SyliusCmsPlugin\Assigner\LocalesAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\LocaleAwareInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Locale\Model\LocaleInterface; | ||
use Sylius\Component\Resource\Repository\RepositoryInterface; | ||
|
||
final class LocalesAssignerSpec extends ObjectBehavior | ||
{ | ||
public function let(RepositoryInterface $localeRepository) | ||
{ | ||
$this->beConstructedWith($localeRepository); | ||
} | ||
|
||
public function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(LocalesAssigner::class); | ||
} | ||
|
||
public function it_implements_locales_assigner_interface() | ||
{ | ||
$this->shouldImplement(LocalesAssignerInterface::class); | ||
} | ||
|
||
public function it_assigns_locales_to_locale_aware_entity( | ||
RepositoryInterface $localeRepository, | ||
LocaleAwareInterface $localesAware, | ||
LocaleInterface $locale1, | ||
LocaleInterface $locale2 | ||
) { | ||
$locale1->getCode()->willReturn('en_US'); | ||
$locale2->getCode()->willReturn('fr_FR'); | ||
|
||
$localeRepository->findAll()->willReturn([$locale1, $locale2]); | ||
|
||
$localesAware->addLocale($locale1)->shouldBeCalled(); | ||
$localesAware->addLocale($locale2)->shouldBeCalled(); | ||
|
||
$this->assign($localesAware, ['en_US', 'fr_FR']); | ||
} | ||
} |
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,54 @@ | ||
<?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; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\ProductsInTaxonsAssigner; | ||
use BitBag\SyliusCmsPlugin\Assigner\ProductsInTaxonsAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\ProductsInTaxonsAwareInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Sylius\Component\Core\Model\TaxonInterface; | ||
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface; | ||
|
||
final class ProductsInTaxonsAssignerSpec extends ObjectBehavior | ||
{ | ||
public function let(TaxonRepositoryInterface $taxonRepository) | ||
{ | ||
$this->beConstructedWith($taxonRepository); | ||
} | ||
|
||
public function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(ProductsInTaxonsAssigner::class); | ||
} | ||
|
||
public function it_implements_products_in_taxons_assigner_interface() | ||
{ | ||
$this->shouldImplement(ProductsInTaxonsAssignerInterface::class); | ||
} | ||
|
||
public function it_assigns_taxons_to_products_in_taxons_aware_entity( | ||
TaxonRepositoryInterface $taxonRepository, | ||
ProductsInTaxonsAwareInterface $productsInTaxonsAware, | ||
TaxonInterface $taxon1, | ||
TaxonInterface $taxon2 | ||
) { | ||
$taxon1->getCode()->willReturn('taxon_code_1'); | ||
$taxon2->getCode()->willReturn('taxon_code_2'); | ||
|
||
$taxonRepository->findOneBy(['code' => 'taxon_code_1'])->willReturn($taxon1); | ||
$taxonRepository->findOneBy(['code' => 'taxon_code_2'])->willReturn($taxon2); | ||
|
||
$productsInTaxonsAware->addProductsInTaxon($taxon1)->shouldBeCalled(); | ||
$productsInTaxonsAware->addProductsInTaxon($taxon2)->shouldBeCalled(); | ||
|
||
$this->assign($productsInTaxonsAware, ['taxon_code_1', 'taxon_code_2']); | ||
} | ||
} |
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,48 @@ | ||
<?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\Resolver; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\LocalesAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\LocaleAwareInterface; | ||
use BitBag\SyliusCmsPlugin\Resolver\ImporterLocalesResolver; | ||
use PhpSpec\ObjectBehavior; | ||
|
||
final class ImporterLocalesResolverSpec extends ObjectBehavior | ||
{ | ||
public function let(LocalesAssignerInterface $localesAssigner) | ||
{ | ||
$this->beConstructedWith($localesAssigner); | ||
} | ||
|
||
public function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(ImporterLocalesResolver::class); | ||
} | ||
|
||
public function it_resolves_locales_for_locale_aware_entity( | ||
LocalesAssignerInterface $localesAssigner, | ||
LocaleAwareInterface $localesAware | ||
) { | ||
$localesRow = 'en_US, fr_FR'; | ||
$localesAssigner->assign($localesAware, ['en_US', 'fr_FR'])->shouldBeCalled(); | ||
|
||
$this->resolve($localesAware, $localesRow); | ||
} | ||
|
||
public function it_does_not_assign_locales_when_locales_row_is_empty( | ||
LocalesAssignerInterface $localesAssigner, | ||
LocaleAwareInterface $localesAware | ||
) { | ||
$localesAssigner->assign($localesAware, [])->shouldNotBeCalled(); | ||
|
||
$this->resolve($localesAware, ''); | ||
} | ||
} |
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,48 @@ | ||
<?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\Resolver; | ||
|
||
use BitBag\SyliusCmsPlugin\Assigner\ProductsInTaxonsAssignerInterface; | ||
use BitBag\SyliusCmsPlugin\Entity\ProductsInTaxonsAwareInterface; | ||
use BitBag\SyliusCmsPlugin\Resolver\ImporterProductsInTaxonsResolver; | ||
use PhpSpec\ObjectBehavior; | ||
|
||
final class ImporterProductsInTaxonsResolverSpec extends ObjectBehavior | ||
{ | ||
public function let(ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner) | ||
{ | ||
$this->beConstructedWith($productsInTaxonsAssigner); | ||
} | ||
|
||
public function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(ImporterProductsInTaxonsResolver::class); | ||
} | ||
|
||
public function it_resolves_taxons_for_products_in_taxons_aware_entity( | ||
ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner, | ||
ProductsInTaxonsAwareInterface $productsInTaxonsAware | ||
) { | ||
$taxonsRow = 'taxon_code_1, taxon_code_2'; | ||
$productsInTaxonsAssigner->assign($productsInTaxonsAware, ['taxon_code_1', 'taxon_code_2'])->shouldBeCalled(); | ||
|
||
$this->resolve($productsInTaxonsAware, $taxonsRow); | ||
} | ||
|
||
public function it_does_not_assign_taxons_when_taxons_row_is_null( | ||
ProductsInTaxonsAssignerInterface $productsInTaxonsAssigner, | ||
ProductsInTaxonsAwareInterface $productsInTaxonsAware | ||
) { | ||
$productsInTaxonsAssigner->assign($productsInTaxonsAware, [])->shouldNotBeCalled(); | ||
|
||
$this->resolve($productsInTaxonsAware, null); | ||
} | ||
} |
Oops, something went wrong.