Skip to content

Commit

Permalink
[DoctrineMongoDBBundle] updated tests with shorter bundle names
Browse files Browse the repository at this point in the history
  • Loading branch information
kriswallsmith committed Mar 28, 2011
1 parent 082fd73 commit 751ba4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Expand Up @@ -23,15 +23,15 @@ public function getContainer()
require_once __DIR__.'/DependencyInjection/Fixtures/Bundles/YamlBundle/YamlBundle.php';

$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.debug' => false,
)));
$loader = new DoctrineMongoDBExtension();
$container->registerExtension($loader);

$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);

return $container;
Expand Down
Expand Up @@ -225,20 +225,20 @@ public function testBundleDocumentAliases()
$container = $this->getContainer();
$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');
$calls = $definition->getMethodCalls();
$this->assertTrue(isset($calls[0][1][0]['YamlBundle']));
$this->assertEquals('DoctrineMongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\YamlBundle\Document', $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]['Yaml']);
}

public function testYamlBundleMappingDetection()
{
$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();
$this->assertEquals('doctrine.odm.mongodb.default_yml_metadata_driver', (string) $calls[0][1][0]);
Expand All @@ -250,7 +250,7 @@ public function testXmlBundleMappingDetection()
$container = $this->getContainer('XmlBundle');
$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();
$this->assertEquals('doctrine.odm.mongodb.default_xml_metadata_driver', (string) $calls[0][1][0]);
Expand All @@ -262,7 +262,7 @@ public function testAnnotationsBundleMappingDetection()
$container = $this->getContainer('AnnotationsBundle');
$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();
$this->assertEquals('doctrine.odm.mongodb.default_annotation_metadata_driver', (string) $calls[0][1][0]);
Expand Down Expand Up @@ -352,9 +352,8 @@ protected function getContainer($bundle = 'YamlBundle')
{
require_once __DIR__.'/Fixtures/Bundles/'.$bundle.'/'.$bundle.'.php';


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.debug' => false,
)));
Expand Down
Expand Up @@ -86,7 +86,7 @@ public function testFullConfiguration($config)
'document_managers' => array(
'dm1' => array(
'mappings' => array(
'FooBundle' => array(
'Foo' => array(
'type' => 'annotations',
),
),
Expand All @@ -103,7 +103,7 @@ public function testFullConfiguration($config)
'connection' => 'dm2_connection',
'database' => 'db1',
'mappings' => array(
'BarBundle' => array(
'Bar' => array(
'type' => 'yml',
'dir' => '%kernel.cache_dir%',
'prefix' => 'prefix_val',
Expand Down
Expand Up @@ -26,7 +26,7 @@ doctrine_mongo_db:
document_managers:
dm1:
mappings:
FooBundle: annotations
Foo: annotations
metadata_cache_driver:
type: memcache
class: fooClass
Expand All @@ -37,7 +37,7 @@ doctrine_mongo_db:
connection: dm2_connection
database: db1
mappings:
BarBundle:
Bar:
type: yml
dir: %kernel.cache_dir%
prefix: prefix_val
Expand Down

0 comments on commit 751ba4d

Please sign in to comment.