-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
229 additions
and
59 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
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,59 @@ | ||
<?php | ||
|
||
namespace Tests\TextCollection; | ||
|
||
use Pim\Behat\Context\DBALPurger; | ||
use Pim\Bundle\ExtendedAttributeTypeBundle\AttributeType\ExtendedAttributeTypes; | ||
use Pim\Component\Catalog\Model\AttributeInterface; | ||
use Pim\Component\Catalog\Repository\AttributeGroupRepositoryInterface; | ||
use Pim\Component\Catalog\Repository\AttributeRepositoryInterface; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
class TextCollectionTest extends KernelTestCase | ||
{ | ||
/** @var ContainerInterface */ | ||
private $container; | ||
|
||
/** @var AttributeRepositoryInterface */ | ||
private $attributeRepo; | ||
|
||
/** @var AttributeGroupRepositoryInterface */ | ||
private $attributeGroupRepo; | ||
|
||
public function setUp() | ||
{ | ||
self::bootKernel(); | ||
$this->container = self::$kernel->getContainer(); | ||
$connection = $this->container->get('doctrine.dbal.default_connection'); | ||
$purger = new DBALPurger($connection, ['pim_catalog_group_attribute', 'pim_catalog_attribute']); | ||
$purger->purge(); | ||
|
||
$this->attributeRepo = $this->container->get('pim_catalog.repository.attribute'); | ||
$this->attributeGroupRepo = $this->container->get('pim_catalog.repository.attribute_group'); | ||
} | ||
|
||
public function testCreateAttribute() | ||
{ | ||
$factory = $this->container->get('pim_catalog.factory.attribute'); | ||
$attribute = $factory->createAttribute('pim_catalog_text_collection'); | ||
$attribute->setCode('my_collection'); | ||
$this->assertEquals(ExtendedAttributeTypes::TEXT_COLLECTION, $attribute->getAttributeType()); | ||
$this->assertEquals(ExtendedAttributeTypes::BACKEND_TYPE_TEXT_COLLECTION, $attribute->getBackendType()); | ||
|
||
$defaultGroup = $this->attributeGroupRepo->findDefaultAttributeGroup(); | ||
$attribute->setGroup($defaultGroup); | ||
|
||
$saver = $this->container->get('pim_catalog.saver.attribute'); | ||
$saver->save($attribute); | ||
unset($attributeGroupRepo); | ||
unset($attribute); | ||
|
||
/** @var AttributeInterface $savedAttribute */ | ||
$savedAttribute = $this->attributeRepo->findOneByIdentifier('my_collection'); | ||
$this->assertInstanceOf(AttributeInterface::class, $savedAttribute); | ||
$this->assertEquals(ExtendedAttributeTypes::TEXT_COLLECTION, $savedAttribute->getAttributeType()); | ||
$this->assertEquals(ExtendedAttributeTypes::BACKEND_TYPE_TEXT_COLLECTION, $savedAttribute->getBackendType()); | ||
$this->assertEquals($defaultGroup->getCode(), $savedAttribute->getGroup()->getCode()); | ||
} | ||
} |
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
2 changes: 0 additions & 2 deletions
2
doc/example/Acme/Bundle/AppBundle/Resources/config/entities.yml
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
doc/example/Acme/Bundle/AppEEBundle/Resources/config/entities.yml
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
doc/example/Acme/Bundle/AppEEBundle/Resources/config/storage_driver/orm/orm.yml
This file was deleted.
Oops, something went wrong.
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,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Acme\Bundle\AppEEBundle\DependencyInjection; | ||
namespace Pim\Bundle\ExtendedCeBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
@@ -10,7 +10,7 @@ | |
/** | ||
* @author Romain Monceau <[email protected]> | ||
*/ | ||
class AcmeAppEEExtension extends Extension | ||
class ExtendedCeExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
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,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Acme\Bundle\AppBundle; | ||
namespace Pim\Bundle\ExtendedCeBundle; | ||
|
||
use Akeneo\Bundle\StorageUtilsBundle\AkeneoStorageUtilsBundle; | ||
use Akeneo\Bundle\StorageUtilsBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; | ||
|
@@ -10,15 +10,15 @@ | |
/** | ||
* @author Romain Monceau <[email protected]> | ||
*/ | ||
class AcmeAppBundle extends Bundle | ||
class ExtendedCeBundle extends Bundle | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
$productMappings = [ | ||
realpath(__DIR__ . '/Resources/config/model/doctrine') => 'Acme\Bundle\AppBundle\Model' | ||
realpath(__DIR__ . '/Resources/config/model/doctrine') => 'Pim\Bundle\ExtendedCeBundle\Model' | ||
]; | ||
|
||
$container->addCompilerPass( | ||
|
2 changes: 1 addition & 1 deletion
2
...e/Bundle/AppBundle/Model/ProductValue.php → ...e/ExtendedCeBundle/Model/ProductValue.php
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
2 changes: 2 additions & 0 deletions
2
doc/example/Pim/Bundle/ExtendedCeBundle/Resources/config/entities.yml
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,2 @@ | ||
parameters: | ||
pim_catalog.entity.product_value.class: Pim\Bundle\ExtendedCeBundle\Model\ProductValue |
2 changes: 1 addition & 1 deletion
2
...g/model/doctrine/ProductValue.mongodb.yml → ...g/model/doctrine/ProductValue.mongodb.yml
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
2 changes: 1 addition & 1 deletion
2
...onfig/model/doctrine/ProductValue.orm.yml → ...onfig/model/doctrine/ProductValue.orm.yml
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
10 changes: 10 additions & 0 deletions
10
doc/example/Pim/Bundle/ExtendedCeBundle/Resources/config/parameters_test.yml
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,10 @@ | ||
parameters: | ||
database_driver: pdo_mysql | ||
database_host: mysql | ||
database_port: null | ||
database_name: akeneo_pim | ||
database_user: akeneo_pim | ||
database_password: akeneo_pim | ||
locale: en | ||
secret: ThisTokenIsNotSoSecretChangeIt | ||
installer_data: PimInstallerBundle:minimal |
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,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Acme\Bundle\AppBundle\DependencyInjection; | ||
namespace Pim\Bundle\ExtendedEeBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
@@ -10,7 +10,7 @@ | |
/** | ||
* @author Romain Monceau <[email protected]> | ||
*/ | ||
class AcmeAppExtension extends Extension | ||
class ExtendedEeExtension extends Extension | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
|
2 changes: 1 addition & 1 deletion
2
.../Doctrine/ORM/EECompletenessGenerator.php → .../Doctrine/ORM/EECompletenessGenerator.php
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace Acme\Bundle\AppEEBundle; | ||
namespace Pim\Bundle\ExtendedEeBundle; | ||
|
||
use Akeneo\Bundle\StorageUtilsBundle\AkeneoStorageUtilsBundle; | ||
use Akeneo\Bundle\StorageUtilsBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; | ||
|
@@ -10,15 +10,15 @@ | |
/** | ||
* @author Romain Monceau <[email protected]> | ||
*/ | ||
class AcmeAppEEBundle extends Bundle | ||
class ExtendedEeBundle extends Bundle | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
$productMappings = [ | ||
realpath(__DIR__ . '/Resources/config/model/doctrine') => 'Acme\Bundle\AppEEBundle\Model' | ||
realpath(__DIR__ . '/Resources/config/model/doctrine') => 'Pim\Bundle\ExtendedEeBundle\Model' | ||
]; | ||
|
||
$container->addCompilerPass( | ||
|
2 changes: 1 addition & 1 deletion
2
...Bundle/AppEEBundle/Model/ProductValue.php → ...e/ExtendedEeBundle/Model/ProductValue.php
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
2 changes: 1 addition & 1 deletion
2
...pEEBundle/Model/PublishedProductValue.php → ...dEeBundle/Model/PublishedProductValue.php
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.