[DoctrineMongoDBBundle] updated tests with shorter bundle names
This commit is contained in:
parent
082fd73b3c
commit
751ba4db5e
@ -23,7 +23,7 @@ class ContainerTest extends TestCase
|
|||||||
require_once __DIR__.'/DependencyInjection/Fixtures/Bundles/YamlBundle/YamlBundle.php';
|
require_once __DIR__.'/DependencyInjection/Fixtures/Bundles/YamlBundle/YamlBundle.php';
|
||||||
|
|
||||||
$container = new ContainerBuilder(new ParameterBag(array(
|
$container = new ContainerBuilder(new ParameterBag(array(
|
||||||
'kernel.bundles' => array('YamlBundle' => 'DoctrineMongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\YamlBundle\YamlBundle'),
|
'kernel.bundles' => array('Yaml' => 'DoctrineMongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\YamlBundle\YamlBundle'),
|
||||||
'kernel.cache_dir' => sys_get_temp_dir(),
|
'kernel.cache_dir' => sys_get_temp_dir(),
|
||||||
'kernel.debug' => false,
|
'kernel.debug' => false,
|
||||||
)));
|
)));
|
||||||
@ -31,7 +31,7 @@ class ContainerTest extends TestCase
|
|||||||
$container->registerExtension($loader);
|
$container->registerExtension($loader);
|
||||||
|
|
||||||
$configs = array();
|
$configs = array();
|
||||||
$configs[] = array('connections' => array('default' => array()), 'document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))));
|
$configs[] = array('connections' => array('default' => array()), 'document_managers' => array('default' => array('mappings' => array('Yaml' => array()))));
|
||||||
$loader->load($configs, $container);
|
$loader->load($configs, $container);
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
|
@ -225,20 +225,20 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
|||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
$loader = new DoctrineMongoDBExtension();
|
$loader = new DoctrineMongoDBExtension();
|
||||||
|
|
||||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))))), $container);
|
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('Yaml' => array()))))), $container);
|
||||||
|
|
||||||
$definition = $container->getDefinition('doctrine.odm.mongodb.default_configuration');
|
$definition = $container->getDefinition('doctrine.odm.mongodb.default_configuration');
|
||||||
$calls = $definition->getMethodCalls();
|
$calls = $definition->getMethodCalls();
|
||||||
$this->assertTrue(isset($calls[0][1][0]['YamlBundle']));
|
$this->assertTrue(isset($calls[0][1][0]['Yaml']));
|
||||||
$this->assertEquals('DoctrineMongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\YamlBundle\Document', $calls[0][1][0]['YamlBundle']);
|
$this->assertEquals('DoctrineMongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\YamlBundle\Document', $calls[0][1][0]['Yaml']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testYamlBundleMappingDetection()
|
public function testYamlBundleMappingDetection()
|
||||||
{
|
{
|
||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
$loader = new DoctrineMongoDBExtension('YamlBundle');
|
$loader = new DoctrineMongoDBExtension();
|
||||||
|
|
||||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('YamlBundle' => array()))))), $container);
|
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('Yaml' => array()))))), $container);
|
||||||
|
|
||||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||||
$this->assertEquals('doctrine.odm.mongodb.default_yml_metadata_driver', (string) $calls[0][1][0]);
|
$this->assertEquals('doctrine.odm.mongodb.default_yml_metadata_driver', (string) $calls[0][1][0]);
|
||||||
@ -250,7 +250,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
|||||||
$container = $this->getContainer('XmlBundle');
|
$container = $this->getContainer('XmlBundle');
|
||||||
$loader = new DoctrineMongoDBExtension();
|
$loader = new DoctrineMongoDBExtension();
|
||||||
|
|
||||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('XmlBundle' => array()))))), $container);
|
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('Xml' => array()))))), $container);
|
||||||
|
|
||||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||||
$this->assertEquals('doctrine.odm.mongodb.default_xml_metadata_driver', (string) $calls[0][1][0]);
|
$this->assertEquals('doctrine.odm.mongodb.default_xml_metadata_driver', (string) $calls[0][1][0]);
|
||||||
@ -262,7 +262,7 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
|||||||
$container = $this->getContainer('AnnotationsBundle');
|
$container = $this->getContainer('AnnotationsBundle');
|
||||||
$loader = new DoctrineMongoDBExtension();
|
$loader = new DoctrineMongoDBExtension();
|
||||||
|
|
||||||
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('AnnotationsBundle' => array()))))), $container);
|
$loader->load(array(array('document_managers' => array('default' => array('mappings' => array('Annotations' => array()))))), $container);
|
||||||
|
|
||||||
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
$calls = $container->getDefinition('doctrine.odm.mongodb.default_metadata_driver')->getMethodCalls();
|
||||||
$this->assertEquals('doctrine.odm.mongodb.default_annotation_metadata_driver', (string) $calls[0][1][0]);
|
$this->assertEquals('doctrine.odm.mongodb.default_annotation_metadata_driver', (string) $calls[0][1][0]);
|
||||||
@ -352,9 +352,8 @@ abstract class AbstractMongoDBExtensionTest extends TestCase
|
|||||||
{
|
{
|
||||||
require_once __DIR__.'/Fixtures/Bundles/'.$bundle.'/'.$bundle.'.php';
|
require_once __DIR__.'/Fixtures/Bundles/'.$bundle.'/'.$bundle.'.php';
|
||||||
|
|
||||||
|
|
||||||
return new ContainerBuilder(new ParameterBag(array(
|
return new ContainerBuilder(new ParameterBag(array(
|
||||||
'kernel.bundles' => array($bundle => 'DoctrineMongoDBBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles\\'.$bundle.'\\'.$bundle),
|
'kernel.bundles' => array(substr($bundle, 0, -6) => 'DoctrineMongoDBBundle\\Tests\\DependencyInjection\\Fixtures\\Bundles\\'.$bundle.'\\'.$bundle),
|
||||||
'kernel.cache_dir' => sys_get_temp_dir(),
|
'kernel.cache_dir' => sys_get_temp_dir(),
|
||||||
'kernel.debug' => false,
|
'kernel.debug' => false,
|
||||||
)));
|
)));
|
||||||
|
@ -86,7 +86,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
'document_managers' => array(
|
'document_managers' => array(
|
||||||
'dm1' => array(
|
'dm1' => array(
|
||||||
'mappings' => array(
|
'mappings' => array(
|
||||||
'FooBundle' => array(
|
'Foo' => array(
|
||||||
'type' => 'annotations',
|
'type' => 'annotations',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -103,7 +103,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
'connection' => 'dm2_connection',
|
'connection' => 'dm2_connection',
|
||||||
'database' => 'db1',
|
'database' => 'db1',
|
||||||
'mappings' => array(
|
'mappings' => array(
|
||||||
'BarBundle' => array(
|
'Bar' => array(
|
||||||
'type' => 'yml',
|
'type' => 'yml',
|
||||||
'dir' => '%kernel.cache_dir%',
|
'dir' => '%kernel.cache_dir%',
|
||||||
'prefix' => 'prefix_val',
|
'prefix' => 'prefix_val',
|
||||||
|
@ -26,7 +26,7 @@ doctrine_mongo_db:
|
|||||||
document_managers:
|
document_managers:
|
||||||
dm1:
|
dm1:
|
||||||
mappings:
|
mappings:
|
||||||
FooBundle: annotations
|
Foo: annotations
|
||||||
metadata_cache_driver:
|
metadata_cache_driver:
|
||||||
type: memcache
|
type: memcache
|
||||||
class: fooClass
|
class: fooClass
|
||||||
@ -37,7 +37,7 @@ doctrine_mongo_db:
|
|||||||
connection: dm2_connection
|
connection: dm2_connection
|
||||||
database: db1
|
database: db1
|
||||||
mappings:
|
mappings:
|
||||||
BarBundle:
|
Bar:
|
||||||
type: yml
|
type: yml
|
||||||
dir: %kernel.cache_dir%
|
dir: %kernel.cache_dir%
|
||||||
prefix: prefix_val
|
prefix: prefix_val
|
||||||
|
Reference in New Issue
Block a user