Skip to content

Commit e6e352f

Browse files
authored
Merge pull request #246 from alcaeus/fix-php-7.x-builds
Fix build for PHP 7.x
2 parents 188a149 + d6427af commit e6e352f

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

Tests/Command/DoctrineCommandTest.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Doctrine\Bundle\MigrationsBundle\Command\DoctrineCommand;
66
use Doctrine\DBAL\Migrations\Configuration\Configuration;
7+
use ReflectionClass;
78
use Symfony\Component\DependencyInjection\ContainerBuilder;
89
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
910

@@ -18,17 +19,41 @@ public function testConfigureMigrations()
1819
$configurationMock->method('getMigrations')
1920
->willReturn(array());
2021

22+
$reflectionClass = new ReflectionClass('Doctrine\DBAL\Migrations\Configuration\Configuration');
23+
if ($reflectionClass->hasMethod('getCustomTemplate')) {
24+
$configurationMock
25+
->expects($this->once())
26+
->method('setCustomTemplate')
27+
->with('migrations.tpl');
28+
}
29+
30+
$configurationMock
31+
->expects($this->once())
32+
->method('setMigrationsTableName')
33+
->with('migrations');
34+
35+
$configurationMock
36+
->expects($this->once())
37+
->method('setMigrationsNamespace')
38+
->with('App\Migrations');
39+
40+
$configurationMock
41+
->expects($this->once())
42+
->method('setMigrationsDirectory')
43+
->with(__DIR__ . '/../../');
44+
2145
DoctrineCommand::configureMigrations($this->getContainer(), $configurationMock);
2246
}
2347

2448
private function getContainer()
2549
{
2650
return new ContainerBuilder(new ParameterBag(array(
27-
'doctrine_migrations.dir_name' => __DIR__.'/../../',
28-
'doctrine_migrations.namespace' => 'test',
29-
'doctrine_migrations.name' => 'test',
30-
'doctrine_migrations.table_name' => 'test',
51+
'doctrine_migrations.dir_name' => __DIR__ . '/../../',
52+
'doctrine_migrations.namespace' => 'App\\Migrations',
53+
'doctrine_migrations.name' => 'App migrations',
54+
'doctrine_migrations.table_name' => 'migrations',
3155
'doctrine_migrations.organize_migrations' => Configuration::VERSIONS_ORGANIZATION_BY_YEAR,
56+
'doctrine_migrations.custom_template' => 'migrations.tpl',
3257
)));
3358
}
3459
}

Tests/DependencyInjection/DoctrineMigrationsExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Doctrine\Bundle\MigrationsBundle\DependencyInjection\DoctrineMigrationsExtension;
66
use Doctrine\DBAL\Migrations\Configuration\Configuration;
7+
use PHPUnit\Framework\TestCase;
78
use Symfony\Component\DependencyInjection\ContainerBuilder;
89
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
910

10-
class DoctrineMigrationsExtensionTest extends \PHPUnit_Framework_TestCase
11+
class DoctrineMigrationsExtensionTest extends TestCase
1112
{
1213
public function testOrganizeMigrations()
1314
{

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"doctrine/migrations": "^1.1"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "^4.8.36"
29+
"phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^7.4"
3030
},
3131
"autoload": {
3232
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\": "" }

0 commit comments

Comments
 (0)