diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..aa02dc6
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+/Tests export-ignore
+/phpunit.xml.dist export-ignore
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..d468878
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,70 @@
+name: Tests
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ tests:
+ name: PHPUnit PHP ${{ matrix.php }} ${{ matrix.dependency }} (Symfony ${{ matrix.symfony }})
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ php:
+ - '8.1'
+ - '8.2'
+ - '8.3'
+ dependency:
+ - ''
+ symfony:
+ - '5.4.*'
+ - '6.3.*'
+ - '6.4.*'
+ - '7.0.*'
+ include:
+ - php: '8.1'
+ symfony: '5.4.*'
+ dependency: 'lowest'
+ exclude:
+ - php: '8.1'
+ symfony: '7.0.*'
+ fail-fast: false
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: pcov
+ tools: flex
+
+ - name: Get Composer Cache Directory
+ id: composer-cache
+ run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+
+ - name: Cache dependencies
+ uses: actions/cache@v3
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: ${{ matrix.php }}-composer-
+
+ - name: Update project dependencies
+ if: matrix.dependency == ''
+ run: composer update --no-progress --ansi --prefer-stable
+ env:
+ SYMFONY_REQUIRE: ${{ matrix.symfony }}
+
+ - name: Update project dependencies lowest
+ if: matrix.dependency == 'lowest'
+ run: composer update --no-progress --ansi --prefer-stable --prefer-lowest
+ env:
+ SYMFONY_REQUIRE: ${{ matrix.symfony }}
+
+ - name: Validate composer
+ run: composer validate --strict --no-check-lock
+
+ - name: Run tests
+ run: vendor/bin/phpunit
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 504e696..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-language: php
-sudo: false
-cache:
- directories:
- - $HOME/.composer/cache/files
-env:
- global:
- - PHPUNIT_FLAGS="-v"
-
-matrix:
- fast_finish: true
- include:
- # Minimum supported Symfony version with the latest PHP version
- - php: 7.3
- env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
-
- # Test the latest stable release
- - php: 7.2
- - php: 7.3
- env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
-
- # Force some major versions of Symfony
- - php: 7.3
- env: DEPENDENCIES="dunglas/symfony-lock:^3"
- - php: 7.3
- env: DEPENDENCIES="dunglas/symfony-lock:^4"
-
- # Latest commit to master
- - php: 7.3
- env: STABILITY="dev"
-
- allow_failures:
- # Dev-master is allowed to fail.
- - env: STABILITY="dev"
-
-before_install:
- - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi;
- - if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
-
-install:
- # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
- - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
- - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
-
-script:
- - composer validate --strict --no-check-lock
- - ./vendor/bin/phpunit $PHPUNIT_FLAGS
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 885c4e8..4236547 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog
+## v4.3.0
+
+- Added support for Symfony 6,
+- Removed support for Symfony <4.4 & >5.0 - <5.3
+
+## v4.2.1
+
+- Support for PHP8
+
+## v4.2.0
+
+- Fix: PSR-4 autoloading (#132)
+- Add `@coversNothing` annotation to prevent raising risky warnings in PHPUnit 9
+- Fix: run `prepend()` for all extensions first, then `load()` then extensions (#126)
+
## v4.1.0
- Support for Symfony 5.
diff --git a/Loader/LoaderFactory.php b/Loader/LoaderFactory.php
index 34c42cc..f1b05ab 100644
--- a/Loader/LoaderFactory.php
+++ b/Loader/LoaderFactory.php
@@ -7,7 +7,6 @@
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
-use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
@@ -56,9 +55,4 @@ public function createPhpFileLoader(ContainerBuilder $container): PhpFileLoader
{
return new PhpFileLoader($container, new FileLocator());
}
-
- public function createIniFileLoader(ContainerBuilder $container): IniFileLoader
- {
- return new IniFileLoader($container, new FileLocator());
- }
}
diff --git a/PhpUnit/AbstractCompilerPassTestCase.php b/PhpUnit/AbstractCompilerPassTestCase.php
index fa9800b..964fbc4 100644
--- a/PhpUnit/AbstractCompilerPassTestCase.php
+++ b/PhpUnit/AbstractCompilerPassTestCase.php
@@ -18,6 +18,8 @@ abstract protected function registerCompilerPass(ContainerBuilder $container): v
* This test will run the compile method.
*
* @test
+ *
+ * @coversNothing
*/
final public function compilation_should_not_fail_with_empty_container(): void
{
diff --git a/PhpUnit/AbstractContainerBuilderTestCase.php b/PhpUnit/AbstractContainerBuilderTestCase.php
index 5ed792a..27cd5e7 100644
--- a/PhpUnit/AbstractContainerBuilderTestCase.php
+++ b/PhpUnit/AbstractContainerBuilderTestCase.php
@@ -6,7 +6,6 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
-use Symfony\Component\DependencyInjection\Reference;
abstract class AbstractContainerBuilderTestCase extends TestCase
{
@@ -250,4 +249,14 @@ final protected function assertContainerBuilderHasServiceLocator(
self::assertThat($definition, new DefinitionEqualsServiceLocatorConstraint($expectedServiceMap));
}
+
+ final protected function assertContainerBuilderServiceDecoration(
+ string $serviceId,
+ string $decoratedServiceId,
+ ?string $renamedId = null,
+ int $priority = 0,
+ ?int $invalidBehavior = null
+ ): void {
+ self::assertThat($this->container, new DefinitionDecoratesConstraint($serviceId, $decoratedServiceId, $renamedId, $priority, $invalidBehavior));
+ }
}
diff --git a/PhpUnit/AbstractExtensionTestCase.php b/PhpUnit/AbstractExtensionTestCase.php
index cbd4dce..ae771eb 100644
--- a/PhpUnit/AbstractExtensionTestCase.php
+++ b/PhpUnit/AbstractExtensionTestCase.php
@@ -53,7 +53,9 @@ final protected function load(array $configurationValues = []): void
if ($extension instanceof PrependExtensionInterface) {
$extension->prepend($this->container);
}
+ }
+ foreach ($this->container->getExtensions() as $extension) {
$extension->load($configs, $this->container);
}
}
diff --git a/PhpUnit/DefinitionDecoratesConstraint.php b/PhpUnit/DefinitionDecoratesConstraint.php
new file mode 100644
index 0000000..6e9a8a9
--- /dev/null
+++ b/PhpUnit/DefinitionDecoratesConstraint.php
@@ -0,0 +1,153 @@
+ 'RUNTIME_EXCEPTION_ON_INVALID_REFERENCE',
+ ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE => 'EXCEPTION_ON_INVALID_REFERENCE',
+ ContainerInterface::NULL_ON_INVALID_REFERENCE => 'NULL_ON_INVALID_REFERENCE',
+ ContainerInterface::IGNORE_ON_INVALID_REFERENCE => 'IGNORE_ON_INVALID_REFERENCE',
+ ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE => 'IGNORE_ON_UNINITIALIZED_REFERENCE',
+ ];
+
+ private string $serviceId;
+ private string $decoratedServiceId;
+ private ?string $renamedId;
+ private int $priority;
+ private ?int $invalidBehavior;
+
+ public function __construct(string $serviceId, string $decoratedServiceId, ?string $renamedId = null, int $priority = 0, ?int $invalidBehavior = null)
+ {
+ $this->serviceId = $serviceId;
+ $this->decoratedServiceId = $decoratedServiceId;
+ $this->renamedId = $renamedId;
+ $this->priority = $priority;
+ $this->invalidBehavior = $invalidBehavior;
+ }
+
+ public function toString(): string
+ {
+ return sprintf(
+ '"%s" decorates service "%s"%s with priority "%d" and "%s" behavior.',
+ $this->serviceId,
+ $this->decoratedServiceId,
+ $this->renamedId !== null ? sprintf(' and renames it to "%s"', $this->renamedId) : '',
+ $this->priority,
+ self::INVALID_BEHAVIORS[$this->invalidBehavior ?? 0]
+ );
+ }
+
+ public function evaluate($other, string $description = '', bool $returnResult = false): bool
+ {
+ if (!($other instanceof ContainerBuilder)) {
+ throw new \InvalidArgumentException(
+ 'Expected an instance of Symfony\Component\DependencyInjection\ContainerBuilder'
+ );
+ }
+
+ return $this->evaluateServiceDefinition($other, $returnResult);
+ }
+
+ private function evaluateServiceDefinition(ContainerBuilder $containerBuilder, bool $returnResult): bool
+ {
+ if (!$containerBuilder->has($this->serviceId)) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has no service "%s"',
+ $this->serviceId
+ )
+ );
+ }
+
+ $definition = $containerBuilder->findDefinition($this->serviceId);
+
+ $decorated = $definition->getDecoratedService();
+
+ if ($decorated === null) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has a service "%s", but it does not decorate any service',
+ $this->serviceId
+ )
+ );
+ }
+
+ if ($decorated[0] !== $this->decoratedServiceId) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has a decorator service "%s", but it does decorate service "%s".',
+ $this->serviceId,
+ $decorated[0]
+ )
+ );
+ }
+
+ if ($decorated[1] !== $this->renamedId) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has a decorator service "%s", but it does not rename decorated service to "%s".',
+ $this->serviceId,
+ $this->renamedId
+ )
+ );
+ }
+
+ if ($decorated[2] !== $this->priority) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has a decorator service "%s", but it does not decorate at expected "%d" priority.',
+ $this->serviceId,
+ $this->priority
+ )
+ );
+ }
+
+ if (($decorated[3] ?? null) !== $this->invalidBehavior) {
+ if ($returnResult) {
+ return false;
+ }
+
+ $this->fail(
+ $this->serviceId,
+ sprintf(
+ 'The container builder has a decorator service "%s", but it does not decorate with expected "%s" behavior.',
+ $this->serviceId,
+ self::INVALID_BEHAVIORS[$this->invalidBehavior]
+ )
+ );
+ }
+
+ return true;
+ }
+}
diff --git a/PhpUnit/DefinitionHasArgumentConstraint.php b/PhpUnit/DefinitionHasArgumentConstraint.php
index 83133b2..5e58d68 100644
--- a/PhpUnit/DefinitionHasArgumentConstraint.php
+++ b/PhpUnit/DefinitionHasArgumentConstraint.php
@@ -4,6 +4,7 @@
use PHPUnit\Framework\Constraint\Constraint;
use PHPUnit\Framework\Constraint\IsEqual;
+use SebastianBergmann\Exporter\Exporter;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
@@ -12,9 +13,10 @@ final class DefinitionHasArgumentConstraint extends Constraint
/**
* @var int|string
*/
- private $argumentIndex;
- private $expectedValue;
- private $checkExpectedValue;
+ private string|int $argumentIndex;
+ private mixed $expectedValue;
+ private bool $checkExpectedValue;
+ private Exporter $exporter;
public function __construct($argumentIndex, $expectedValue, bool $checkExpectedValue = true)
{
@@ -37,6 +39,7 @@ public function __construct($argumentIndex, $expectedValue, bool $checkExpectedV
$this->argumentIndex = $argumentIndex;
$this->expectedValue = $expectedValue;
$this->checkExpectedValue = $checkExpectedValue;
+ $this->exporter = new Exporter();
}
public function toString(): string
@@ -98,6 +101,18 @@ private function evaluateArgumentValue(Definition $definition, bool $returnResul
{
$actualValue = $definition->getArgument($this->argumentIndex);
+ if (gettype($actualValue) !== gettype($this->expectedValue)) {
+ $this->fail(
+ $definition,
+ sprintf(
+ 'The value of argument named "%s" (%s) is not equal to the expected value (%s)',
+ $this->argumentIndex,
+ $this->exporter->export($actualValue),
+ $this->exporter->export($this->expectedValue)
+ )
+ );
+ }
+
$constraint = new IsEqual($this->expectedValue);
if (!$constraint->evaluate($actualValue, '', true)) {
@@ -109,15 +124,15 @@ private function evaluateArgumentValue(Definition $definition, bool $returnResul
$message = sprintf(
'The value of argument named "%s" (%s) is not equal to the expected value (%s)',
$this->argumentIndex,
- $this->exporter()->export($actualValue),
- $this->exporter()->export($this->expectedValue)
+ $this->exporter->export($actualValue),
+ $this->exporter->export($this->expectedValue)
);
} else {
$message = sprintf(
'The value of argument with index %d (%s) is not equal to the expected value (%s)',
$this->argumentIndex,
- $this->exporter()->export($actualValue),
- $this->exporter()->export($this->expectedValue)
+ $this->exporter->export($actualValue),
+ $this->exporter->export($this->expectedValue)
);
}
diff --git a/README.md b/README.md
index 4db622c..1bfeb4a 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
*By Matthias Noback and contributors*
-[![Build Status](https://secure.travis-ci.org/SymfonyTest/SymfonyDependencyInjectionTest.png)](http://travis-ci.org/SymfonyTest/SymfonyDependencyInjectionTest)
+[![Build Status](https://github.com/SymfonyTest/SymfonyDependencyInjectionTest/actions/workflows/ci.yaml/badge.svg)](https://github.com/SymfonyTest/SymfonyDependencyInjectionTest/actions/workflows/ci.yaml)
This library contains several PHPUnit test case classes and many semantic [assertions](#list-of-assertions) which
you can use to functionally test your [container extensions](#testing-a-container-extension) (or "bundle extensions")
@@ -16,7 +16,9 @@ these classes.
Using Composer:
- php composer.phar require --dev matthiasnoback/symfony-dependency-injection-test
+```bash
+composer require --dev matthiasnoback/symfony-dependency-injection-test
+```
## Usage
@@ -35,9 +37,9 @@ class MyExtensionTest extends AbstractExtensionTestCase
{
protected function getContainerExtensions(): array
{
- return array(
+ return [
new MyExtension()
- );
+ ];
}
}
```
@@ -92,7 +94,7 @@ class MyExtensionTest extends AbstractExtensionTestCase
*/
public function after_loading_the_correct_parameter_has_been_set()
{
- $this->load(array('my' => array('enabled' => 'false')));
+ $this->load(['my' => ['enabled' => 'false']);
...
}
@@ -102,7 +104,7 @@ class MyExtensionTest extends AbstractExtensionTestCase
To prevent duplication of required configuration values, you can provide some minimal configuration, by overriding
the ``getMinimalConfiguration()`` method of the test case.
-## Testing a compiler pass
+### Testing a compiler pass
To test a compiler pass, create a test class and extend from
``Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase``. Then implement the ``registerCompilerPass()`` method:
@@ -149,15 +151,15 @@ class MyCompilerPassTest extends AbstractCompilerPassTestCase
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
'collecting_service_id',
'add',
- array(
+ [
new Reference('collected_service')
- )
+ ]
);
}
}
```
-### Standard test for unobtrusiveness
+#### Standard test for unobtrusiveness
The ``AbstractCompilerPassTestCase`` class always executes one specific test -
``compilation_should_not_fail_with_empty_container()`` - which makes sure that the compiler pass is unobtrusive. For
@@ -217,7 +219,7 @@ PHP files, but also closures. When you create a ``Configuration`` class for your
of these formats is supported. Special attention needs to be given to XML files.
In order to verify that any type of configuration file will be correctly loaded by your bundle, you must install the
-[SymfonyConfigTest](https://github.com/matthiasnoback/SymfonyConfigTest) library and create a test class that extends
+[SymfonyConfigTest](https://github.com/SymfonyTest/SymfonyConfigTest) library and create a test class that extends
from ``AbstractExtensionConfigurationTestCase``:
```php
@@ -270,14 +272,14 @@ class ConfigurationTest extends AbstractExtensionConfigurationTestCase
*/
public function it_converts_extension_elements_to_extensions()
{
- $expectedConfiguration = array(
- 'extensions' => array('twig.extension.foo', 'twig.extension.bar')
- );
+ $expectedConfiguration = [
+ 'extensions' => ['twig.extension.foo', 'twig.extension.bar']
+ ];
- $sources = array(
+ $sources = [
__DIR__ . '/Fixtures/config.yml',
__DIR__ . '/Fixtures/config.xml',
- );
+ ];
$this->assertProcessedConfigurationEquals($expectedConfiguration, $sources);
}
@@ -318,10 +320,10 @@ the given index, and its value is the given value.
assertContainerBuilderHasServiceDefinitionWithServiceLocatorArgument($serviceId, $argumentIndex, $expectedValue)
Assert that the ContainerBuilder
for this test has a service definition with the given id, which has an argument
at the given index, and its value is a ServiceLocator with a reference-map equal to the given value.
-assertContainerBuilderHasServiceDefinitionWithMethodCall($serviceId, $method, array $arguments = array(), $index = null)
+assertContainerBuilderHasServiceDefinitionWithMethodCall($serviceId, $method, array $arguments = [], $index = null)
Assert that the ContainerBuilder
for this test has a service definition with the given id, which has a method call to
the given method with the given arguments. If index is provided, invocation index order of method call is asserted as well.
-assertContainerBuilderHasServiceDefinitionWithTag($serviceId, $tag, array $attributes = array())
+assertContainerBuilderHasServiceDefinitionWithTag($serviceId, $tag, array $attributes = [])
Assert that the ContainerBuilder
for this test has a service definition with the given id, which has the given tag with the given arguments.
assertContainerBuilderHasServiceDefinitionWithParent($serviceId, $parentServiceId)
Assert that the ContainerBuilder
for this test has a service definition with the given id which is a decorated service and it has the given parent service.
@@ -345,9 +347,9 @@ container:
## Version Guidance
-| Version | Released | PHPUnit | Status |
-|---------|--------------|------------|------------|
-| 4.x | Mar 28, 2019 | 8.x | Latest |
-| 3.x | Mar 5, 2018 | 7.x | Bugfixes |
-| 2.x | May 9, 2017 | 6.x | Bugfixes |
-| 1.x | Jul 4, 2016 | 4.x and 5x | EOL |
+| Version | Released | PHPUnit | Status |
+|---------|--------------|-------------|------------|
+| 4.x | Mar 28, 2019 | 8.x and 9.x | Latest |
+| 3.x | Mar 5, 2018 | 7.x | Bugfixes |
+| 2.x | May 9, 2017 | 6.x | Bugfixes |
+| 1.x | Jul 4, 2016 | 4.x and 5.x | EOL |
diff --git a/Tests/Fixtures/DependableExtension.php b/Tests/Fixtures/DependableExtension.php
new file mode 100644
index 0000000..60c0ba3
--- /dev/null
+++ b/Tests/Fixtures/DependableExtension.php
@@ -0,0 +1,29 @@
+hasParameter('parameter_from_non_dependable')) {
+ $container->setParameter('dependable_parameter', 'dependable value');
+ }
+ }
+
+ public function getAlias()
+ {
+ return 'dependable';
+ }
+
+ public function getNamespace(): void
+ {
+ }
+
+ public function getXsdValidationBasePath(): void
+ {
+ }
+}
diff --git a/Tests/Fixtures/MatthiasDependencyInjectionTestExtension.php b/Tests/Fixtures/MatthiasDependencyInjectionTestExtension.php
index a2047aa..aa19748 100644
--- a/Tests/Fixtures/MatthiasDependencyInjectionTestExtension.php
+++ b/Tests/Fixtures/MatthiasDependencyInjectionTestExtension.php
@@ -7,6 +7,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Reference;
class MatthiasDependencyInjectionTestExtension implements ExtensionInterface
{
@@ -33,6 +34,11 @@ public function load(array $config, ContainerBuilder $container): void
// add an alias to an existing service
$container->setAlias('manual_alias', 'service_id');
+
+ // add a reference to an existing service
+ $definition = new Definition('manual_with_reference');
+ $definition->addArgument(new Reference('manual_service_id'));
+ $container->setDefinition('manual_with_reference', $definition);
}
public function getAlias()
diff --git a/Tests/Fixtures/NonDependablePrependableExtension.php b/Tests/Fixtures/NonDependablePrependableExtension.php
new file mode 100644
index 0000000..d6c9398
--- /dev/null
+++ b/Tests/Fixtures/NonDependablePrependableExtension.php
@@ -0,0 +1,32 @@
+setParameter('parameter_from_non_dependable', 'non-dependable value');
+ }
+}
diff --git a/Tests/Fixtures/SimpleConfiguration.php b/Tests/Fixtures/SimpleConfiguration.php
index d781bff..3ad7c69 100644
--- a/Tests/Fixtures/SimpleConfiguration.php
+++ b/Tests/Fixtures/SimpleConfiguration.php
@@ -7,15 +7,10 @@
class SimpleConfiguration implements ConfigurationInterface
{
- public function getConfigTreeBuilder()
+ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('simple');
-
- if (method_exists($treeBuilder, 'getRootNode')) {
- $rootNode = $treeBuilder->getRootNode();
- } else {
- $rootNode = $treeBuilder->root('simple');
- }
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->fixXmlConfig('type', 'types')
diff --git a/Tests/Loader/LoaderFactoryTest.php b/Tests/Loader/LoaderFactoryTest.php
index a5ce098..de17e1e 100644
--- a/Tests/Loader/LoaderFactoryTest.php
+++ b/Tests/Loader/LoaderFactoryTest.php
@@ -3,12 +3,19 @@
namespace Matthias\SymfonyDependencyInjectionTest\Tests\Loader;
use Matthias\SymfonyDependencyInjectionTest\Loader\LoaderFactory;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
+use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
+use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
class LoaderFactoryTest extends TestCase
{
/**
* @test
+ *
* @dataProvider fileProvider
*/
public function it_creates_the_appropriate_file_loader_based_on_the_extension($file, $expectedClass): void
@@ -29,25 +36,21 @@ public function it_creates_a_closure_loader_when_source_is_a_closure(): void
$factory = new LoaderFactory();
$loader = $factory->createLoaderForSource($this->createMockContainerBuilder(), $source);
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\Loader\ClosureLoader', $loader);
+ $this->assertInstanceOf(ClosureLoader::class, $loader);
}
- public function fileProvider()
+ public static function fileProvider()
{
return [
- ['file.xml', 'Symfony\Component\DependencyInjection\Loader\XmlFileLoader'],
- ['file.yml', 'Symfony\Component\DependencyInjection\Loader\YamlFileLoader'],
- ['file.yaml', 'Symfony\Component\DependencyInjection\Loader\YamlFileLoader'],
- ['file.php', 'Symfony\Component\DependencyInjection\Loader\PhpFileLoader'],
+ ['file.xml', XmlFileLoader::class],
+ ['file.yml', YamlFileLoader::class],
+ ['file.yaml', YamlFileLoader::class],
+ ['file.php', PhpFileLoader::class],
];
}
- private function createMockContainerBuilder()
+ private function createMockContainerBuilder(): MockObject&ContainerBuilder
{
- return $this
- ->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
- ->disableOriginalConstructor()
- ->setMethods(null)
- ->getMock();
+ return $this->createMock(ContainerBuilder::class);
}
}
diff --git a/Tests/PhpUnit/AbstractDependableExtensionTestCaseTest.php b/Tests/PhpUnit/AbstractDependableExtensionTestCaseTest.php
new file mode 100644
index 0000000..780be39
--- /dev/null
+++ b/Tests/PhpUnit/AbstractDependableExtensionTestCaseTest.php
@@ -0,0 +1,28 @@
+load();
+
+ $this->assertContainerBuilderHasParameter('dependable_parameter', 'dependable value');
+ }
+}
diff --git a/Tests/PhpUnit/AbstractExtensionTestCaseTest.php b/Tests/PhpUnit/AbstractExtensionTestCaseTest.php
index 906b949..dfd85b6 100644
--- a/Tests/PhpUnit/AbstractExtensionTestCaseTest.php
+++ b/Tests/PhpUnit/AbstractExtensionTestCaseTest.php
@@ -214,6 +214,19 @@ public function if_definition_has_argument_but_with_wrong_value_it_fails(): void
$this->assertContainerBuilderHasServiceDefinitionWithArgument('manual_service_id', 1, 'wrong value');
}
+ /**
+ * @test
+ */
+ public function if_definition_has_argument_but_with_wrong_value_it_fails1(): void
+ {
+ $this->load();
+
+ $this->expectException(ExpectationFailedException::class);
+ $this->expectExceptionMessage('The value of argument named "0"');
+
+ $this->assertContainerBuilderHasServiceDefinitionWithArgument('manual_with_reference', 0, 'manual_service_id');
+ }
+
/**
* @test
*/
@@ -308,4 +321,30 @@ public function if_service_is_not_defined_it_does_not_fail(): void
$this->assertContainerBuilderNotHasService('undefined');
}
+
+ /**
+ * @test
+ */
+ public function if_service_is_not_defined_in_service_decoration_it_fails(): void
+ {
+ $this->load();
+
+ $this->expectException(ExpectationFailedException::class);
+ $this->expectExceptionMessage('The container builder has no service "undefined"');
+
+ $this->assertContainerBuilderServiceDecoration('undefined', 'undefined');
+ }
+
+ /**
+ * @test
+ */
+ public function if_service_decoration_is_not_defined_in_service_decoration_it_fails(): void
+ {
+ $this->load();
+
+ $this->expectException(ExpectationFailedException::class);
+ $this->expectExceptionMessage('The container builder has a service "manual_service_id", but it does not decorate any service');
+
+ $this->assertContainerBuilderServiceDecoration('manual_service_id', 'undefined');
+ }
}
diff --git a/Tests/PhpUnit/ContainerBuilderHasAliasConstraintTest.php b/Tests/PhpUnit/ContainerBuilderHasAliasConstraintTest.php
index acd8682..428df7d 100644
--- a/Tests/PhpUnit/ContainerBuilderHasAliasConstraintTest.php
+++ b/Tests/PhpUnit/ContainerBuilderHasAliasConstraintTest.php
@@ -10,6 +10,7 @@ class ContainerBuilderHasAliasConstraintTest extends TestCase
{
/**
* @test
+ *
* @dataProvider containerBuilderProvider
*/
public function match(ContainerBuilder $containerBuilder, $alias, $expectedServiceId, $shouldMatch): void
@@ -19,7 +20,7 @@ public function match(ContainerBuilder $containerBuilder, $alias, $expectedServi
$this->assertSame($shouldMatch, $constraint->evaluate($containerBuilder, '', true));
}
- public function containerBuilderProvider()
+ public static function containerBuilderProvider()
{
$emptyContainerBuilder = new ContainerBuilder();
diff --git a/Tests/PhpUnit/ContainerBuilderHasServiceDefinitionConstraintTest.php b/Tests/PhpUnit/ContainerBuilderHasServiceDefinitionConstraintTest.php
index 9aedfc2..8f23984 100644
--- a/Tests/PhpUnit/ContainerBuilderHasServiceDefinitionConstraintTest.php
+++ b/Tests/PhpUnit/ContainerBuilderHasServiceDefinitionConstraintTest.php
@@ -1,6 +1,6 @@
assertSame($shouldMatch, $constraint->evaluate($containerBuilder, '', true));
}
- public function containerBuilderProvider()
+ public static function containerBuilderProvider()
{
$emptyContainerBuilder = new ContainerBuilder();
diff --git a/Tests/PhpUnit/ContainerBuilderHasSyntheticServiceConstraintTest.php b/Tests/PhpUnit/ContainerBuilderHasSyntheticServiceConstraintTest.php
index bc48bcb..39d332c 100644
--- a/Tests/PhpUnit/ContainerBuilderHasSyntheticServiceConstraintTest.php
+++ b/Tests/PhpUnit/ContainerBuilderHasSyntheticServiceConstraintTest.php
@@ -1,6 +1,6 @@
createMockContainerWithParameters($containerParameters);
$constraint = new ContainerHasParameterConstraint($parameterName, $parameterValue, $checkParameterValue);
$this->assertSame($expectedToMatch, $constraint->evaluate($container, '', true));
@@ -29,38 +31,37 @@ public function match(
* @dataProvider typeAwareContainerBuilderProvider
*/
public function matchWithType(
- ContainerInterface $container,
+ array $containerParameters,
$parameterName,
$parameterValue,
$checkParameterValue,
$expectedToMatch
): void {
+ $container = $this->createMockContainerWithParameters($containerParameters);
$constraint = new ContainerHasParameterConstraint($parameterName, $parameterValue, $checkParameterValue, true);
$this->assertSame($expectedToMatch, $constraint->evaluate($container, '', true));
}
- public function containerBuilderProvider()
+ public static function containerBuilderProvider() : array
{
- $emptyContainer = $this->createMockContainerWithParameters([]);
-
$parameterName = 'parameter_name';
$parameterValue = 'some value';
$wrongParameterValue = 'some other value';
return [
// the container does not have the parameter
- [$emptyContainer, $parameterName, $parameterValue, true, false],
+ [[], $parameterName, $parameterValue, true, false],
// the container has the parameter but the values don't match
- [$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $wrongParameterValue, true, false],
+ [[$parameterName => $parameterValue], $parameterName, $wrongParameterValue, true, false],
// the container has the parameter and the value matches
- [$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $parameterValue, true, true],
+ [[$parameterName => $parameterValue], $parameterName, $parameterValue, true, true],
// the container has the parameter and the value is optional
- [$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, null, false, true],
+ [[$parameterName => $parameterValue], $parameterName, null, false, true],
];
}
- public function typeAwareContainerBuilderProvider()
+ public static function typeAwareContainerBuilderProvider() : array
{
$parameterName = 'parameter_name';
$parameterValue = '123123';
@@ -68,9 +69,9 @@ public function typeAwareContainerBuilderProvider()
return [
// the container has the parameter but the type don't match
- [$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $wrongParameterValue, true, false],
+ [[$parameterName => $parameterValue], $parameterName, $wrongParameterValue, true, false],
// the container has the parameter and the value matches
- [$this->createMockContainerWithParameters([$parameterName => $parameterValue]), $parameterName, $parameterValue, true, true],
+ [[$parameterName => $parameterValue], $parameterName, $parameterValue, true, true],
];
}
@@ -79,14 +80,14 @@ private function createMockContainerWithParameters(array $parameters)
$container = $this->createMock(ContainerInterface::class);
$container
- ->expects($this->any())
+ ->expects(self::any())
->method('hasParameter')
->willReturnCallback(function ($parameterName) use ($parameters) {
return array_key_exists($parameterName, $parameters);
});
$container
- ->expects($this->any())
+ ->expects(self::any())
->method('getParameter')
->willReturnCallback(function ($parameterName) use ($parameters) {
return $parameters[$parameterName];
diff --git a/Tests/PhpUnit/DefinitionArgumentEqualsServiceLocatorConstraintTest.php b/Tests/PhpUnit/DefinitionArgumentEqualsServiceLocatorConstraintTest.php
index ab52be9..2464543 100644
--- a/Tests/PhpUnit/DefinitionArgumentEqualsServiceLocatorConstraintTest.php
+++ b/Tests/PhpUnit/DefinitionArgumentEqualsServiceLocatorConstraintTest.php
@@ -22,10 +22,6 @@ final class DefinitionArgumentEqualsServiceLocatorConstraintTest extends TestCas
protected function setUp(): void
{
- if (!class_exists(ServiceLocator::class)) {
- $this->markTestSkipped('Requires the Symfony DependencyInjection component v3.4 or higher');
- }
-
$this->containerBuilder = new ContainerBuilder();
}
@@ -65,7 +61,7 @@ public function if_fails_if_the_service_definition_value_is_not_a_valid_referenc
$this->assertConstraintFails(new DefinitionArgumentEqualsServiceLocatorConstraint('using_service', 0, [new Reference('foo')]));
}
- public function provideInvalidServiceLocatorReferences()
+ public static function provideInvalidServiceLocatorReferences()
{
yield [['']];
yield [[null]];
diff --git a/Tests/PhpUnit/DefinitionDecoratesConstraintTest.php b/Tests/PhpUnit/DefinitionDecoratesConstraintTest.php
new file mode 100644
index 0000000..9864384
--- /dev/null
+++ b/Tests/PhpUnit/DefinitionDecoratesConstraintTest.php
@@ -0,0 +1,69 @@
+assertSame($expectedToMatch, $constraint->evaluate($containerBuilder, '', true));
+ }
+
+ public static function containerBuilderProvider(): iterable
+ {
+ $containerBuilder = new ContainerBuilder();
+ $containerBuilder->setDefinition('decorated1', new Definition('DecoratedClass1'));
+ $containerBuilder->setDefinition('decorated2', new Definition('DecoratedClass2'));
+ $containerBuilder->setDefinition('decorated3', new Definition('DecoratedClass3'));
+ $containerBuilder->setDefinition('decorated4', new Definition('DecoratedClass4'));
+ $containerBuilder->setDefinition('decorated5', new Definition('DecoratedClass5'));
+
+ $containerBuilder->setDefinition('decorator1', (new Definition('DecoratorClass1'))->setDecoratedService('decorated1'));
+ $containerBuilder->setDefinition('decorator2', (new Definition('DecoratorClass2'))->setDecoratedService('decorated2', 'decorated2_0'));
+ $containerBuilder->setDefinition('decorator3', (new Definition('DecoratorClass3'))->setDecoratedService('decorated3', null, 10));
+ $containerBuilder->setDefinition('decorator4', (new Definition('DecoratorClass4'))->setDecoratedService('decorated4', null, 0, ContainerInterface::IGNORE_ON_INVALID_REFERENCE));
+ $containerBuilder->setDefinition('decorator5', (new Definition('DecoratorClass5'))->setDecoratedService('decorated5', 'decorated5_0', -3, ContainerInterface::NULL_ON_INVALID_REFERENCE));
+
+ yield [$containerBuilder, false, 'not_decorator', 'decorated', null, 0, null];
+ yield [$containerBuilder, true, 'decorator1', 'decorated1', null, 0, null];
+ yield [$containerBuilder, true, 'decorator2', 'decorated2', 'decorated2_0', 0, null];
+ yield [$containerBuilder, true, 'decorator3', 'decorated3', null, 10, null];
+ yield [$containerBuilder, true, 'decorator4', 'decorated4', null, 0, 3];
+ yield [$containerBuilder, true, 'decorator5', 'decorated5', 'decorated5_0', -3, 2];
+ }
+
+ /**
+ * @test
+ *
+ * @dataProvider stringRepresentationProvider
+ */
+ public function it_has_a_string_representation(DefinitionDecoratesConstraint $constraint, string $expectedRepresentation): void
+ {
+ $this->assertSame($expectedRepresentation, $constraint->toString());
+ }
+
+ public static function stringRepresentationProvider(): iterable
+ {
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated'), '"decorator" decorates service "decorated" with priority "0" and "RUNTIME_EXCEPTION_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0'), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "0" and "RUNTIME_EXCEPTION_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "RUNTIME_EXCEPTION_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3, 0), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "RUNTIME_EXCEPTION_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3, 1), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "EXCEPTION_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3, 2), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "NULL_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3, 3), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "IGNORE_ON_INVALID_REFERENCE" behavior.'];
+ yield [new DefinitionDecoratesConstraint('decorator', 'decorated', 'decorated_0', -3, 4), '"decorator" decorates service "decorated" and renames it to "decorated_0" with priority "-3" and "IGNORE_ON_UNINITIALIZED_REFERENCE" behavior.'];
+ }
+}
diff --git a/Tests/PhpUnit/DefinitionEqualsServiceLocatorTest.php b/Tests/PhpUnit/DefinitionEqualsServiceLocatorTest.php
index c8e4fab..5a6d5f7 100644
--- a/Tests/PhpUnit/DefinitionEqualsServiceLocatorTest.php
+++ b/Tests/PhpUnit/DefinitionEqualsServiceLocatorTest.php
@@ -20,10 +20,6 @@ final class DefinitionEqualsServiceLocatorTest extends TestCase
protected function setUp(): void
{
- if (!class_exists(ServiceLocator::class)) {
- $this->markTestSkipped('Requires the Symfony DependencyInjection component v3.4 or higher');
- }
-
$this->containerBuilder = new ContainerBuilder();
}
@@ -49,7 +45,7 @@ public function if_fails_if_the_service_definition_value_is_not_a_valid_referenc
);
}
- public function provideInvalidServiceLocatorReferences()
+ public static function provideInvalidServiceLocatorReferences()
{
yield [['']];
yield [[null]];
@@ -70,13 +66,8 @@ public function it_does_not_fail_if_the_service_definition_is_a_service_locator(
);
}
- public function provideValidServiceLocatorDefs()
+ public static function provideValidServiceLocatorDefs()
{
- // Data providers get called before setUp?
- if (!class_exists(ServiceLocator::class)) {
- return [[], []];
- }
-
yield [
['bar' => new ServiceClosureArgument(new Reference('foo'))],
['bar' => new Reference('foo')],
diff --git a/Tests/PhpUnit/DefinitionHasArgumentConstraintTest.php b/Tests/PhpUnit/DefinitionHasArgumentConstraintTest.php
index 4be8fe7..2988272 100644
--- a/Tests/PhpUnit/DefinitionHasArgumentConstraintTest.php
+++ b/Tests/PhpUnit/DefinitionHasArgumentConstraintTest.php
@@ -1,18 +1,18 @@
assertSame($shouldMatch, $constraint->evaluate($definition, '', true));
}
- public function definitionProvider()
+ public static function definitionProvider()
{
$definitionWithNoArguments = new Definition();
@@ -33,11 +33,7 @@ public function definitionProvider()
$definitionWithArguments->setArguments($arguments);
$parentServiceId = 'parent_service_id';
- if (class_exists(ChildDefinition::class)) {
- $decoratedDefinitionWithArguments = new ChildDefinition($parentServiceId);
- } else {
- $decoratedDefinitionWithArguments = new DefinitionDecorator($parentServiceId);
- }
+ $decoratedDefinitionWithArguments = new ChildDefinition($parentServiceId);
$decoratedDefinitionWithArguments->setArguments([0 => 'first argument', 1 => $wrongValue]);
$decoratedDefinitionWithArguments->replaceArgument(1, $rightValue);
@@ -56,6 +52,7 @@ public function definitionProvider()
/**
* @test
+ *
* @dataProvider invalid_definition_indexes
*
* @param mixed $argument
@@ -72,7 +69,7 @@ public function validates_definitionIndex($argument, $exceptionMessage): void
/**
* @return \Generator
*/
- public function invalid_definition_indexes()
+ public static function invalid_definition_indexes()
{
yield [
new \stdClass(), 'Expected either a string or a positive integer for $argumentIndex.',
@@ -97,6 +94,7 @@ public function invalid_definition_indexes()
/**
* @test
+ *
* @dataProvider indexed_arguments
*
* @param int $argumentIndex
@@ -121,7 +119,9 @@ public function supports_indexed_arguments($argumentIndex): void
self::assertStringStartsWith(
sprintf(
'The value of argument with index %d (\'%s\') is not equal to the expected value (\'%s\')',
- $argumentIndex, $expectedValue, $failingExpectation
+ $argumentIndex,
+ $expectedValue,
+ $failingExpectation
),
$e->getMessage()
);
@@ -131,7 +131,7 @@ public function supports_indexed_arguments($argumentIndex): void
/**
* @return \Generator
*/
- public function indexed_arguments()
+ public static function indexed_arguments()
{
// yield [0];
yield [1];
@@ -141,6 +141,7 @@ public function indexed_arguments()
/**
* @test
+ *
* @dataProvider named_arguments
*
* @param string $argument
@@ -167,7 +168,9 @@ public function supports_named_arguments($argument): void
self::assertStringStartsWith(
sprintf(
'The value of argument named "%s" (\'%s\') is not equal to the expected value (\'%s\')',
- $argument, $expectedValue, $failingExpectation
+ $argument,
+ $expectedValue,
+ $failingExpectation
),
$e->getMessage()
);
@@ -177,7 +180,7 @@ public function supports_named_arguments($argument): void
/**
* @return \Generator
*/
- public function named_arguments()
+ public static function named_arguments()
{
yield ['$foo'];
yield ['$bar'];
diff --git a/Tests/PhpUnit/DefinitionHasMethodCallConstraintTest.php b/Tests/PhpUnit/DefinitionHasMethodCallConstraintTest.php
index c84b20c..a9ce7ac 100644
--- a/Tests/PhpUnit/DefinitionHasMethodCallConstraintTest.php
+++ b/Tests/PhpUnit/DefinitionHasMethodCallConstraintTest.php
@@ -1,6 +1,6 @@
assertSame($expectedToMatch, $constraint->evaluate($definition, '', true));
}
- public function definitionProvider()
+ public static function definitionProvider()
{
$definitionWithNoMethodCalls = new Definition();
diff --git a/Tests/PhpUnit/DefinitionHasTagConstraintTest.php b/Tests/PhpUnit/DefinitionHasTagConstraintTest.php
index 6c0829c..edb10f3 100644
--- a/Tests/PhpUnit/DefinitionHasTagConstraintTest.php
+++ b/Tests/PhpUnit/DefinitionHasTagConstraintTest.php
@@ -1,6 +1,6 @@
assertSame($expectedToMatch, $constraint->evaluate($definition, '', true));
}
- public function definitionProvider()
+ public static function definitionProvider()
{
$definition = new Definition();
- if (class_exists(ChildDefinition::class)) {
- $decoratedDefinition = new ChildDefinition('parent_service_id');
- } else {
- $decoratedDefinition = new DefinitionDecorator('parent_service_id');
- }
+ $decoratedDefinition = new ChildDefinition('parent_service_id');
return [
// the provided definition has the same parent service id
diff --git a/composer.json b/composer.json
index 557faaa..8f9a2f1 100644
--- a/composer.json
+++ b/composer.json
@@ -2,8 +2,8 @@
"name": "matthiasnoback/symfony-dependency-injection-test",
"type": "library",
"description": "Library for testing user classes related to the Symfony Dependency Injection Component",
- "keywords": ["symfony2", "dependency injection", "phpunit"],
- "homepage": "http://github.com/matthiasnoback/SymfonyDependencyInjectionTest",
+ "keywords": ["symfony2", "dependency injection", "phpunit", "dev"],
+ "homepage": "https://github.com/matthiasnoback/SymfonyDependencyInjectionTest",
"license": "MIT",
"authors": [
{
@@ -13,24 +13,30 @@
}
],
"require": {
- "php": "^7.2",
- "matthiasnoback/symfony-config-test": "^4.0.1",
- "symfony/dependency-injection": "^3.4 || ^4.4 || ^5.0",
- "symfony/config": "^3.4 || ^4.4 || ^5.0",
- "symfony/yaml": "^3.4 || ^4.4 || ^5.0"
+ "php": "^8.1",
+ "matthiasnoback/symfony-config-test": "^5.0",
+ "symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0",
+ "symfony/config": "^5.4 || ^6.2 || ^7.0",
+ "symfony/yaml": "^5.4 || ^6.2 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^8.0"
+ "phpunit/phpunit": "^9.6 || ^10.0"
},
"conflict": {
- "phpunit/phpunit": "<8.0"
+ "phpunit/phpunit": "<9.6 || >=11.0"
},
"autoload": {
- "psr-4" : { "Matthias\\SymfonyDependencyInjectionTest\\" : "" }
+ "psr-4" : { "Matthias\\SymfonyDependencyInjectionTest\\" : "" },
+ "exclude-from-classmap": ["/Tests/"]
+ },
+ "autoload-dev": {
+ "psr-4" : { "Matthias\\SymfonyDependencyInjectionTest\\Tests\\" : "Tests/" }
},
"extra": {
"branch-alias": {
- "dev-master": "4.0.x-dev"
+ "dev-master": "5.0.x-dev"
}
- }
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 016cf5a..27de55f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,24 +1,24 @@
+ colors="true"
+>
- Tests
+ Tests
-
-
- .
-
- Tests
- vendor
-
-
-
+
+
+ ./
+
+
+ ./Tests
+ ./vendor
+
+