Skip to content

Commit b33234f

Browse files
juntereinertheofidry
authored andcommitted
Fix the builds (#488)
- use `pcov` instead of `phpdbg` - bump minimum PHP version required from 7.1 to 7.2 - upgrade to PHPUnit 8 - bump a few dependencies to make it work with lowest dependencies
1 parent a4d25ba commit b33234f

11 files changed

+53
-65
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/.php_cs.cache
55
/phpunit.xml
66
/vendor/
7+
/var/
8+
.phpunit.result.cache

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- '7.1'
54
- '7.2'
65
- nightly
76

@@ -47,8 +46,8 @@ before_install:
4746
- if [ "$SYMFONY_REQUIRE" != "" ]; then composer global require --no-scripts symfony/flex; fi
4847
- |
4948
if [ -n "$COVERAGE" ]; then
49+
pecl install pcov;
5050
PHPUNIT_FLAGS="$PHPUNIT_FLAGS --testdox --coverage-text"
51-
PHPUNIT_BIN="phpdbg -qrr $PHPUNIT_BIN"
5251
5352
if [ ! -e $OCULAR_BIN ]; then
5453
wget https://scrutinizer-ci.com/ocular.phar -O $OCULAR_BIN

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@
3131
},
3232

3333
"require": {
34-
"php": "^7.1",
34+
"php": "^7.2",
3535
"doctrine/doctrine-bundle": "^1.8",
3636
"doctrine/data-fixtures": "^1.2",
3737
"doctrine/orm": "^2.5.11",
3838
"psr/log": "^1.0",
3939
"symfony/finder": "^3.4 || ^4.0",
40-
"symfony/framework-bundle": "^3.4 || ^4.0",
40+
"symfony/framework-bundle": "^3.4.24 || ^4.0",
4141
"theofidry/alice-data-fixtures": "^1.0"
4242
},
4343
"require-dev": {
4444
"doctrine/persistence": "^1.0",
45-
"phpunit/phpunit": "^7.0",
45+
"phpunit/phpunit": "^8.5",
4646
"phpspec/prophecy": "^1.7",
47-
"symfony/phpunit-bridge": "^3.4 || ^4.0"
47+
"symfony/phpunit-bridge": "^3.4.31 || ^4.0"
4848
},
4949

5050
"extra": {

tests/Alice/Generator/Instantiator/Chainable/InstantiatedReferenceInstantiatorTest.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ public function testCanInstantiateFixtureWitAServiceReferenceFactory()
9393
$this->assertTrue($instantiator->canInstantiate($fixture));
9494
}
9595

96-
/**
97-
* @expectedException \LogicException
98-
* @expectedExceptionMessage Expected instantiator method "Hautelook\AliceBundle\Alice\Generator\Instantiator\Chainable\InstantiatedReferenceInstantiator::instantiate" to be used only if it has a container, but no container could be found.
99-
*/
10096
public function testThrowsAnExceptionIfNoContainerIsSetWhilstTryingToInstantiateObject()
10197
{
98+
$this->expectException(\LogicException::class);
99+
$this->expectExceptionMessage('Expected instantiator method "Hautelook\AliceBundle\Alice\Generator\Instantiator\Chainable\InstantiatedReferenceInstantiator::instantiate" to be used only if it has a container, but no container could be found.');
100+
102101
$fixture = new SimpleFixture(
103102
'dummy',
104103
City::class,
@@ -156,12 +155,11 @@ public function testInstantiatesObjectWithFactoryAndArguments()
156155
$this->assertEquals($expected, $actual);
157156
}
158157

159-
/**
160-
* @expectedException \Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationException
161-
* @expectedExceptionMessage Instantiated fixture was expected to be an instance of "Dummy". Got "Hautelook\AliceBundle\Functional\TestBundle\Entity\City" instead.
162-
*/
163158
public function testThrowsAnExceptionIfTheInstantiatedFixtureIsNotOfTheClassExpected()
164159
{
160+
$this->expectException(\Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationException::class);
161+
$this->expectExceptionMessage('Instantiated fixture was expected to be an instance of "Dummy". Got "Hautelook\AliceBundle\Functional\TestBundle\Entity\City" instead.');
162+
165163
$fixture = new SimpleFixture(
166164
'dummy',
167165
'Dummy',

tests/Console/Command/Doctrine/LoadDataFixturesCommandIntegrationTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class LoadDataFixturesCommandIntegrationTest extends TestCase
5151
/**
5252
* {@inheritdoc}
5353
*/
54-
protected function setUp()
54+
protected function setUp(): void
5555
{
5656
if (false === class_exists(DoctrineBundle::class, true)) {
5757
$this->markTestSkipped('DoctrineBundle is not installed.');
@@ -90,7 +90,7 @@ protected function setUp()
9090
/**
9191
* {@inheritdoc}
9292
*/
93-
protected function tearDown()
93+
protected function tearDown(): void
9494
{
9595
$this->kernel->shutdown();
9696
}
@@ -143,12 +143,12 @@ public function testAppendFixtures()
143143

144144
/**
145145
* @dataProvider loadCommandProvider
146-
*
147-
* @expectedException \InvalidArgumentException
148-
* @expectedExceptionMessageRegExp /^Doctrine (fixtures|ORM) Manager named "foo" does not exist\.$/
149146
*/
150147
public function testFixturesRegisteringUsingInvalidManager(array $inputs, string $expected)
151148
{
149+
$this->expectException(\InvalidArgumentException::class);
150+
$this->expectExceptionMessageMatches('/^Doctrine (fixtures|ORM) Manager named "foo" does not exist\.$/');
151+
152152
$command = $this->application->find('hautelook:fixtures:load');
153153
$commandTester = new CommandTester($command);
154154
$commandTester->execute(

tests/Console/Command/Doctrine/LoadDataFixturesCommandTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ public function testCanResetTheCommandApplication()
5454
$this->assertTrue(true);
5555
}
5656

57-
/**
58-
* @expectedException \InvalidArgumentException
59-
* @expectedExceptionMessage Expected application to be an instance of "Symfony\Bundle\FrameworkBundle\Console\Application".
60-
*/
6157
public function testThrowsAnExceptionIfInvalidApplicationIsGiven()
6258
{
59+
$this->expectException(\InvalidArgumentException::class);
60+
$this->expectExceptionMessage('Expected application to be an instance of "Symfony\Bundle\FrameworkBundle\Console\Application".');
61+
6362
$command = new DoctrineOrmLoadDataFixturesCommand('dummy', new FakeDoctrineManagerRegistry(), new FakeLoader());
6463
$command->setApplication(new ConsoleApplication());
6564
}

tests/DependencyInjection/HautelookAliceBundleTest.php

+7-9
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,27 @@ class HautelookAliceBundleTest extends TestCase
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function tearDown()
37+
public function tearDown(): void
3838
{
3939
if (null !== $this->kernel) {
4040
$this->kernel->shutdown();
4141
}
4242
}
4343

44-
/**
45-
* @expectedException \LogicException
46-
* @expectedExceptionMessage To register "Hautelook\AliceBundle\HautelookAliceBundle", you also need: "Doctrine\Bundle\DoctrineBundle\DoctrineBundle", "Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle".
47-
*/
4844
public function testCannotBootIfFidryAliceDataFixturesBundleIsNotRegistered()
4945
{
46+
$this->expectException(\LogicException::class);
47+
$this->expectExceptionMessage('To register "Hautelook\AliceBundle\HautelookAliceBundle", you also need: "Doctrine\Bundle\DoctrineBundle\DoctrineBundle", "Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle".');
48+
5049
$this->kernel = new ConfigurableKernel('ConfigurableKernel0', true);
5150
$this->kernel->boot();
5251
}
5352

54-
/**
55-
* @expectedException \LogicException
56-
* @expectedExceptionMessage To register "Hautelook\AliceBundle\HautelookAliceBundle", you also need: "Doctrine\Bundle\DoctrineBundle\DoctrineBundle".
57-
*/
5853
public function testWillReplaceFixtureLoadCommandWithErrorInformationCommandIfDoctrineBundleIsNotRegistered()
5954
{
55+
$this->expectException(\LogicException::class);
56+
$this->expectExceptionMessage('To register "Hautelook\AliceBundle\HautelookAliceBundle", you also need: "Doctrine\Bundle\DoctrineBundle\DoctrineBundle".');
57+
6058
$this->kernel = new WithoutDoctrineKernel('ConfigurableKernel1', true);
6159
$this->kernel->addBundle(new FidryAliceDataFixturesBundle());
6260
$this->kernel->addBundle(new NelmioAliceBundle());

tests/Loader/DoctrineOrmLoaderTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public function testIsNotClonable()
4040
$this->assertFalse((new ReflectionClass(DoctrineOrmLoader::class))->isCloneable());
4141
}
4242

43-
/**
44-
* @expectedException \InvalidArgumentException
45-
* @expectedExceptionMessage Expected loader to be an instance of "Fidry\AliceDataFixtures\Persistence\PersisterAwareInterface".
46-
*/
4743
public function testDataFixtureLoaderMustBePersisterAware()
4844
{
45+
$this->expectException(\InvalidArgumentException::class);
46+
$this->expectExceptionMessage('Expected loader to be an instance of "Fidry\AliceDataFixtures\Persistence\PersisterAwareInterface".');
47+
4948
new DoctrineOrmLoader(new FakeBundleResolver(), new FakeFixtureLocator(), new FakeLoader(), new FakeLoader(), new FakeLogger());
5049
}
5150
}

tests/Locator/EnvDirectoryLocatorTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testGetFilesFromABundle(array $bundles, string $environment, arr
4343
$locator = new EnvDirectoryLocator($paths, [$invalidPath]);
4444
$actual = $locator->locateFiles($bundles, $environment);
4545

46-
$this->assertEquals($expected, $actual, '', 0.0, 10, true);
46+
$this->assertEqualsCanonicalizing($expected, $actual);
4747
}
4848

4949
public function provideSets()
@@ -106,7 +106,7 @@ public function provideSets()
106106
[],
107107
];
108108

109-
yield 'bundle with fixture files' => [
109+
yield 'bundle with fixture files 2' => [
110110
[new DummyBundle()],
111111
'',
112112
['Resources/fixtures/test'],
@@ -149,7 +149,7 @@ public function testGetFilesFromSeveralBundles(
149149
$locator = new EnvDirectoryLocator($paths, [$invalidPath]);
150150
$actual = $locator->locateFiles($bundles, $environment);
151151

152-
$this->assertEquals($expected, $actual, '', 0.0, 10, true);
152+
$this->assertEqualsCanonicalizing($expected, $actual);
153153
}
154154

155155
public function provideSetsForSeveralBundles()

tests/Resolver/Bundle/SimpleBundleResolverTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ public function testCanResolveBundles()
5050
$kernel->shutdown();
5151
}
5252

53-
/**
54-
* @expectedException \Hautelook\AliceBundle\Exception\Resolver\BundleNotFoundException
55-
* @expectedExceptionMessage The bundle "UnknownBundle" was not found. Bundles available are: ["ABundle", "BBundle"].
56-
*/
5753
public function testThrowsAnExceptionWhenBundleCoudlNotBeFound()
5854
{
55+
$this->expectException(\Hautelook\AliceBundle\Exception\Resolver\BundleNotFoundException::class);
56+
$this->expectExceptionMessage('The bundle "UnknownBundle" was not found. Bundles available are: ["ABundle", "BBundle"].');
57+
5958
$kernel = new ResolverKernel(__FUNCTION__, true);
6059
$application = new Application($kernel);
6160
$kernel->boot();

tests/Resolver/File/KernelFileResolverTest.php

+16-22
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class KernelFileResolverTest extends TestCase
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function tearDown()
34+
public function tearDown(): void
3535
{
3636
if (null !== $this->kernel) {
3737
$this->kernel->shutdown();
@@ -60,31 +60,28 @@ public function testReturnResolvedFiles()
6060
$this->assertSame($expected, $actual);
6161
}
6262

63-
/**
64-
* @expectedException \TypeError
65-
*/
6663
public function testThrowsAnErrorIfOneOfTheFilePathGivenIsNotAString()
6764
{
65+
$this->expectException(\TypeError::class);
66+
6867
$resolver = new KernelFileResolver(new DummyKernel());
6968
$resolver->resolve([true]);
7069
}
7170

72-
/**
73-
* @expectedException \InvalidArgumentException
74-
* @expectedExceptionMessage The file "unknown" was not found.
75-
*/
7671
public function testThrowsAnExceptionIfFileDoesNotExist()
7772
{
73+
$this->expectException(\InvalidArgumentException::class);
74+
$this->expectExceptionMessage('The file "unknown" was not found.');
75+
7876
$resolver = new KernelFileResolver(new DummyKernel());
7977
$resolver->resolve(['unknown']);
8078
}
8179

82-
/**
83-
* @expectedException \InvalidArgumentException
84-
* @expectedExceptionMessageRegExp /^Expected "\/.*?\/tests\/Resolver\/File" to be a fixture file, got a directory instead\.$/
85-
*/
8680
public function testThrowsAnExceptionIfFileIsADirectory()
8781
{
82+
$this->expectException(\InvalidArgumentException::class);
83+
$this->expectExceptionMessageMatches('/^Expected "\/.*?\/tests\/Resolver\/File" to be a fixture file, got a directory instead\.$/');
84+
8885
$resolver = new KernelFileResolver(new DummyKernel());
8986
$resolver->resolve([__DIR__]);
9087
}
@@ -110,11 +107,10 @@ public function testResolveFileWithTheKernelIfPossible()
110107
$this->assertSame($expected, $actual);
111108
}
112109

113-
/**
114-
* @expectedException \TypeError
115-
*/
116110
public function testThrowsAnErrorIfTheFileResolvedByTheKernelIsNotAString()
117111
{
112+
$this->expectException(\TypeError::class);
113+
118114
$files = [
119115
'@SimpleBundle/files/foo.yml',
120116
];
@@ -127,11 +123,10 @@ public function testThrowsAnErrorIfTheFileResolvedByTheKernelIsNotAString()
127123
$resolver->resolve($files);
128124
}
129125

130-
/**
131-
* @expectedException \InvalidArgumentException
132-
*/
133126
public function testThrowsAnExceptionIfFileResolvedByTheKernelDoesNotExist()
134127
{
128+
$this->expectException(\InvalidArgumentException::class);
129+
135130
$files = [
136131
'@SimpleBundle/dummy.yml',
137132
];
@@ -143,12 +138,11 @@ public function testThrowsAnExceptionIfFileResolvedByTheKernelDoesNotExist()
143138
$resolver->resolve($files);
144139
}
145140

146-
/**
147-
* @expectedException \InvalidArgumentException
148-
* @expectedExceptionMessage Expected "@SimpleBundle/files" to be a fixture file, got a directory instead.
149-
*/
150141
public function testThrowsAnExceptionIfFileResolvedByTheKernelIsADirectory()
151142
{
143+
$this->expectException(\InvalidArgumentException::class);
144+
$this->expectExceptionMessage('Expected "@SimpleBundle/files" to be a fixture file, got a directory instead.');
145+
152146
$files = [
153147
'@SimpleBundle/files',
154148
];

0 commit comments

Comments
 (0)