Skip to content

Commit 3b4b4c6

Browse files
Merge pull request #28 from cordoval/phpunit4-compat
testing travis
2 parents fe2ddb8 + 542d665 commit 3b4b4c6

9 files changed

+40
-16
lines changed

.travis.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ php:
66
- 5.5
77

88
env:
9-
- SYMFONY_VERSION=2.0.*
10-
- SYMFONY_VERSION=2.1.*
11-
- SYMFONY_VERSION=2.2.*
12-
- SYMFONY_VERSION=2.3.*
13-
- SYMFONY_VERSION=2.4.*
14-
- SYMFONY_VERSION=dev-master
9+
- SYMFONY_VERSION=2.4.* PHPUNIT_VERSION=~3.7
10+
- SYMFONY_VERSION=2.0.* PHPUNIT_VERSION=~4.0
11+
- SYMFONY_VERSION=2.1.* PHPUNIT_VERSION=~4.0
12+
- SYMFONY_VERSION=2.2.* PHPUNIT_VERSION=~4.0
13+
- SYMFONY_VERSION=2.3.* PHPUNIT_VERSION=~4.0
14+
- SYMFONY_VERSION=2.4.* PHPUNIT_VERSION=~4.0
1515

1616
before_script:
17-
- composer require --dev symfony/dependency-injection:${SYMFONY_VERSION}
17+
- composer require --no-update "symfony/dependency-injection:${SYMFONY_VERSION}"
18+
- composer require --no-update "phpunit/phpunit:${PHPUNIT_VERSION}"
19+
- composer update
1820

1921
notifications:
2022
2123

2224
cache:
2325
directories:
24-
- /home/travis/.composer/cache
26+
- $COMPOSER_CACHE_DIR

PhpUnit/ContainerBuilderHasAliasConstraint.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\ContainerBuilder;
67

78
class ContainerBuilderHasAliasConstraint extends \PHPUnit_Framework_Constraint
89
{
910
private $aliasId;
1011
private $expectedServiceId;
12+
protected $exporter;
1113

1214
public function __construct($aliasId, $expectedServiceId)
1315
{
@@ -21,6 +23,7 @@ public function __construct($aliasId, $expectedServiceId)
2123

2224
$this->aliasId = $aliasId;
2325
$this->expectedServiceId = $expectedServiceId;
26+
$this->exporter = new Exporter;
2427
}
2528

2629
public function toString()

PhpUnit/ContainerBuilderHasServiceDefinitionConstraint.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\ContainerBuilder;
67

78
class ContainerBuilderHasServiceDefinitionConstraint extends \PHPUnit_Framework_Constraint
89
{
910
private $serviceId;
1011
private $expectedClass;
12+
protected $exporter;
1113

1214
public function __construct($serviceId, $expectedClass)
1315
{
@@ -21,6 +23,7 @@ public function __construct($serviceId, $expectedClass)
2123

2224
$this->serviceId = $serviceId;
2325
$this->expectedClass = $expectedClass;
26+
$this->exporter = new Exporter;
2427
}
2528

2629
public function toString()
@@ -86,8 +89,8 @@ private function evaluateClass(ContainerBuilder $containerBuilder, $returnResult
8689
$this->fail($containerBuilder, sprintf(
8790
'The class of the service definition of "%s" (%s) does not match the expected value (%s)',
8891
$this->serviceId,
89-
\PHPUnit_Util_Type::export($actualClass),
90-
\PHPUnit_Util_Type::export($this->expectedClass)
92+
$this->exporter->export($actualClass),
93+
$this->exporter->export($this->expectedClass)
9194
));
9295
}
9396

PhpUnit/ContainerBuilderHasSyntheticServiceConstraint.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\ContainerBuilder;
67

78
class ContainerBuilderHasSyntheticServiceConstraint extends \PHPUnit_Framework_Constraint
89
{
910
private $serviceId;
11+
protected $exporter;
1012

1113
public function __construct($serviceId)
1214
{
@@ -15,6 +17,7 @@ public function __construct($serviceId)
1517
}
1618

1719
$this->serviceId = $serviceId;
20+
$this->exporter = new Exporter;
1821
}
1922

2023
public function toString()

PhpUnit/ContainerHasParameterConstraint.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\ContainerInterface;
67

78
class ContainerHasParameterConstraint extends \PHPUnit_Framework_Constraint
89
{
910
private $parameterName;
1011
private $expectedParameterValue;
12+
protected $exporter;
1113

1214
public function __construct($parameterName, $expectedParameterValue)
1315
{
1416
$this->parameterName = $parameterName;
1517
$this->expectedParameterValue = $expectedParameterValue;
18+
$this->exporter = new Exporter;
1619
}
1720

1821
public function toString()
@@ -72,8 +75,8 @@ private function evaluateParameterValue(ContainerInterface $container, $returnRe
7275
$this->fail($container, sprintf(
7376
'The value of parameter "%s" (%s) does not match the expected value (%s)',
7477
$this->parameterName,
75-
\PHPUnit_Util_Type::export($this->expectedParameterValue),
76-
\PHPUnit_Util_Type::export($actualValue)
78+
$this->exporter->export($this->expectedParameterValue),
79+
$this->exporter->export($actualValue)
7780
));
7881
}
7982

PhpUnit/DefinitionHasArgumentConstraint.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\Definition;
67
use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
78

89
class DefinitionHasArgumentConstraint extends \PHPUnit_Framework_Constraint
910
{
1011
private $argumentIndex;
1112
private $expectedValue;
13+
protected $exporter;
1214

1315
public function __construct($argumentIndex, $expectedValue)
1416
{
1517
$this->argumentIndex = (integer)$argumentIndex;
1618
$this->expectedValue = $expectedValue;
19+
$this->exporter = new Exporter;
1720
}
1821

1922
public function toString()
@@ -87,8 +90,8 @@ private function evaluateArgumentValue(Definition $definition, $returnResult)
8790
sprintf(
8891
'The value of argument with index %d (%s) is not equal to the expected value (%s)',
8992
$this->argumentIndex,
90-
\PHPUnit_Util_Type::export($actualValue),
91-
\PHPUnit_Util_Type::export($this->expectedValue)
93+
$this->exporter->export($actualValue),
94+
$this->exporter->export($this->expectedValue)
9295
)
9396
);
9497
}

PhpUnit/DefinitionHasMethodCallConstraint.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\Definition;
67

78
class DefinitionHasMethodCallConstraint extends \PHPUnit_Framework_Constraint
89
{
910
private $methodName;
1011
private $arguments;
12+
protected $exporter;
1113

1214
public function __construct($methodName, array $arguments = array())
1315
{
1416
$this->methodName = $methodName;
1517
$this->arguments = $arguments;
18+
$this->exporter = new Exporter;
1619
}
1720

1821
public function evaluate($other, $description = '', $returnResult = false)
@@ -41,7 +44,7 @@ public function evaluate($other, $description = '', $returnResult = false)
4144
sprintf(
4245
'None of the method calls matched the expected method "%s" with arguments %s',
4346
$this->methodName,
44-
\PHPUnit_Util_Type::export($this->arguments)
47+
$this->exporter->export($this->arguments)
4548
)
4649
);
4750
}

PhpUnit/DefinitionIsChildOfConstraint.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
namespace Matthias\SymfonyDependencyInjectionTest\PhpUnit;
44

5+
use SebastianBergmann\Exporter\Exporter;
56
use Symfony\Component\DependencyInjection\Definition;
67
use Symfony\Component\DependencyInjection\DefinitionDecorator;
78

89
class DefinitionIsChildOfConstraint extends \PHPUnit_Framework_Constraint
910
{
1011
private $expectedParentServiceId;
12+
protected $exporter;
1113

1214
public function __construct($expectedParentServiceId)
1315
{
1416
$this->expectedParentServiceId = $expectedParentServiceId;
17+
$this->exporter = new Exporter;
1518
}
1619

1720
public function evaluate($other, $description = '', $returnResult = false)

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"require": {
1616
"matthiasnoback/symfony-config-test": "0.*",
1717
"symfony/dependency-injection": "2.*",
18-
"phpunit/phpunit": "3.*"
18+
"phpunit/phpunit": ">=3",
19+
"sebastian/exporter": "~1"
1920
},
2021
"target-dir": "Matthias/SymfonyDependencyInjectionTest",
2122
"autoload": {

0 commit comments

Comments
 (0)