Skip to content

Commit 4dd7fbe

Browse files
committed
Added test
1 parent c2cc16f commit 4dd7fbe

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Doctrine\Bundle\MigrationsBundle\Tests\DependencyInjection;
4+
5+
use Doctrine\Bundle\MigrationsBundle\DependencyInjection\DoctrineMigrationsExtension;
6+
use Doctrine\DBAL\Migrations\Configuration\Configuration;
7+
use Symfony\Component\DependencyInjection\ContainerBuilder;
8+
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
9+
10+
class DoctrineMigrationsExtensionTest extends \PHPUnit_Framework_TestCase
11+
{
12+
public function testOrganizeMigrations()
13+
{
14+
$container = $this->getContainer();
15+
$extension = new DoctrineMigrationsExtension();
16+
17+
$config = array(
18+
'organize_migrations' => 'BY_YEAR',
19+
);
20+
21+
$extension->load(array('doctrine_migrations' => $config), $container);
22+
23+
$this->assertEquals(Configuration::VERSIONS_ORGANIZATION_BY_YEAR, $container->getParameter('doctrine_migrations.organize_migrations'));
24+
}
25+
26+
private function getContainer()
27+
{
28+
return new ContainerBuilder(new ParameterBag(array(
29+
'kernel.debug' => false,
30+
'kernel.bundles' => array(),
31+
'kernel.cache_dir' => sys_get_temp_dir(),
32+
'kernel.environment' => 'test',
33+
'kernel.root_dir' => __DIR__.'/../../', // src dir
34+
)));
35+
}
36+
}

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"doctrine/doctrine-bundle": "~1.0",
2626
"doctrine/migrations": "^1.1"
2727
},
28+
"require-dev": {
29+
"phpunit/phpunit": "~4.8"
30+
},
2831
"autoload": {
2932
"psr-4": { "Doctrine\\Bundle\\MigrationsBundle\\": "" }
3033
},

phpunit.xml.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit colors="true" bootstrap="vendor/autoload.php">
4+
<testsuites>
5+
<testsuite name="DoctrineMigrationsBundle for the Symfony Framework">
6+
<directory>./Tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
10+
<filter>
11+
<whitelist>
12+
<directory>.</directory>
13+
<exclude>
14+
<directory>./Resources</directory>
15+
<directory>./Tests</directory>
16+
<directory>./vendor</directory>
17+
</exclude>
18+
</whitelist>
19+
</filter>
20+
</phpunit>

0 commit comments

Comments
 (0)