-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migration initialization from cw_feature.* to ae_feature.*
- Loading branch information
1 parent
717ca56
commit 9068802
Showing
2 changed files
with
154 additions
and
26 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,33 +1,43 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<parameters> | ||
<parameter key="cw_feature.manager.class">Ae\FeatureBundle\Entity\FeatureManager</parameter> | ||
<parameter key="cw_feature.security.class">Ae\FeatureBundle\Security\FeatureSecurity</parameter> | ||
<parameter key="cw_feature.feature.class">Ae\FeatureBundle\Service\Feature</parameter> | ||
<parameter key="cw_feature.twig.extension.feature.class">Ae\FeatureBundle\Twig\Extension\FeatureExtension</parameter> | ||
<parameter key="ae_feature.manager.class">Ae\FeatureBundle\Entity\FeatureManager</parameter> | ||
<parameter key="ae_feature.security.class">Ae\FeatureBundle\Security\FeatureSecurity</parameter> | ||
<parameter key="ae_feature.feature.class">Ae\FeatureBundle\Service\Feature</parameter> | ||
<parameter key="ae_feature.twig.extension.feature.class">Ae\FeatureBundle\Twig\Extension\FeatureExtension</parameter> | ||
<!-- deprecated parameters, to be removed from v2.0.0 --> | ||
<parameter key="cw_feature.manager.class">%ae_feature.manager.class%</parameter> | ||
<parameter key="cw_feature.security.class">%ae_feature.security.class%</parameter> | ||
<parameter key="cw_feature.feature.class">%ae_feature.feature.class%</parameter> | ||
<parameter key="cw_feature.twig.extension.feature.class">%ae_feature.twig.extension.feature.class%</parameter> | ||
</parameters> | ||
|
||
<services> | ||
<service id="cw_feature.manager" class="%cw_feature.manager.class%"> | ||
<argument type="service" id="doctrine.orm.entity_manager" /> | ||
</service> | ||
|
||
<service id="cw_feature.security" class="%cw_feature.security.class%" public="false"> | ||
<argument type="service" id="security.context" /> | ||
</service> | ||
|
||
<service id="cw_feature.feature" class="%cw_feature.feature.class%"> | ||
<argument type="service" id="cw_feature.manager" /> | ||
<argument type="service" id="cw_feature.security" /> | ||
</service> | ||
|
||
<service id="cw_feature.twig.extension.feature" class="%cw_feature.twig.extension.feature.class%" public="false"> | ||
<tag name="twig.extension" /> | ||
<argument type="service" id="cw_feature.feature" /> | ||
<service class="%ae_feature.manager.class%" id="ae_feature.manager"> | ||
<argument id="doctrine.orm.entity_manager" type="service"/> | ||
</service> | ||
<service class="%ae_feature.security.class%" id="ae_feature.security" public="false"> | ||
<argument id="security.context" type="service"/> | ||
</service> | ||
<service class="%ae_feature.feature.class%" id="ae_feature.feature"> | ||
<argument id="ae_feature.manager" type="service"/> | ||
<argument id="ae_feature.security" type="service"/> | ||
</service> | ||
<service class="%ae_feature.twig.extension.feature.class%" id="ae_feature.twig.extension.feature" public="false"> | ||
<argument id="ae_feature.feature" type="service"/> | ||
<tag name="twig.extension"/> | ||
</service> | ||
<!-- deprecated services, to be removed from v2.0.0 --> | ||
<service id="cw_feature.manager" parent="ae_feature.manager"> | ||
<deprecated>The "%service_id%" service is deprecated since 1.1 and will be removed in 2.0.</deprecated> | ||
</service> | ||
<service id="cw_feature.security" parent="ae_feature.security"> | ||
<deprecated>The "%service_id%" service is deprecated since 1.1 and will be removed in 2.0.</deprecated> | ||
</service> | ||
<service id="cw_feature.feature" parent="ae_feature.feature"> | ||
<deprecated>The "%service_id%" service is deprecated since 1.1 and will be removed in 2.0.</deprecated> | ||
</service> | ||
<service id="cw_feature.twig.extension.feature" parent="ae_feature.twig.extension.feature"> | ||
<deprecated>The "%service_id%" service is deprecated since 1.1 and will be removed in 2.0.</deprecated> | ||
</service> | ||
</services> | ||
</container> |
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,118 @@ | ||
<?php | ||
|
||
namespace Ae\FeatureBundle\Tests\DependencyInjection; | ||
|
||
use Ae\FeatureBundle\DependencyInjection\AeFeatureExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
|
||
/** | ||
* @covers \Ae\FeatureBundle\DependencyInjection\AeFeatureExtension | ||
*/ | ||
class AeFeatureExtensionTest extends AbstractExtensionTestCase | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
protected function getContainerExtensions() | ||
{ | ||
return [ | ||
new AeFeatureExtension(), | ||
]; | ||
} | ||
|
||
/** | ||
* Test parameters "alias" to migrate from CreativeWeb to AdEspresso. | ||
* | ||
* @param string $parameterName | ||
* @param string $expectedParameterValue | ||
* | ||
* @dataProvider parametersProvider | ||
* @group legacy | ||
*/ | ||
public function testLegacyParameters($parameterName, $expectedParameterValue) | ||
{ | ||
$this->load(); | ||
$this->compile(); | ||
|
||
$parameterName = 'cw' . substr($parameterName, 2); | ||
$this->assertContainerBuilderHasParameter($parameterName, $expectedParameterValue); | ||
} | ||
|
||
/** | ||
* Test parameters. | ||
* | ||
* @param string $parameterName | ||
* @param string $expectedParameterValue | ||
* | ||
* @dataProvider parametersProvider | ||
*/ | ||
public function testParameters($parameterName, $expectedParameterValue) | ||
{ | ||
$this->load(); | ||
$this->compile(); | ||
|
||
$this->assertContainerBuilderHasParameter($parameterName, $expectedParameterValue); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function parametersProvider() | ||
{ | ||
return [ | ||
['ae_feature.manager.class', 'Ae\FeatureBundle\Entity\FeatureManager'], | ||
['ae_feature.security.class', 'Ae\FeatureBundle\Security\FeatureSecurity'], | ||
['ae_feature.feature.class', 'Ae\FeatureBundle\Service\Feature'], | ||
['ae_feature.twig.extension.feature.class', 'Ae\FeatureBundle\Twig\Extension\FeatureExtension'], | ||
]; | ||
} | ||
|
||
|
||
/** | ||
* Test services "alias" to migrate from CreativeWeb to AdEspresso. | ||
* | ||
* @param string $serviceId | ||
* @param string $expectedClass | ||
* | ||
* @dataProvider servicesProvider | ||
* @group legacy | ||
*/ | ||
public function testLegacyServices($serviceId, $expectedClass) | ||
{ | ||
$this->load(); | ||
$this->compile(); | ||
|
||
$oldServiceId = 'cw' . substr($serviceId, 2); | ||
$this->assertContainerBuilderHasService($serviceId, $expectedClass); | ||
$this->assertContainerBuilderHasServiceDefinitionWithParent($oldServiceId, $serviceId); | ||
} | ||
|
||
/** | ||
* Test services. | ||
* | ||
* @param string $serviceId | ||
* @param string $expectedClass | ||
* | ||
* @dataProvider servicesProvider | ||
*/ | ||
public function testServices($serviceId, $expectedClass) | ||
{ | ||
$this->load(); | ||
$this->compile(); | ||
|
||
$this->assertContainerBuilderHasService($serviceId, $expectedClass); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function servicesProvider() | ||
{ | ||
return [ | ||
['ae_feature.manager', 'Ae\FeatureBundle\Entity\FeatureManager'], | ||
['ae_feature.security', 'Ae\FeatureBundle\Security\FeatureSecurity'], | ||
['ae_feature.feature', 'Ae\FeatureBundle\Service\Feature'], | ||
['ae_feature.twig.extension.feature', 'Ae\FeatureBundle\Twig\Extension\FeatureExtension'], | ||
]; | ||
} | ||
} |