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