Skip to content

Instantly share code, notes, and snippets.

@fprochazka
Created August 18, 2014 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fprochazka/0a0b12fa38b942683581 to your computer and use it in GitHub Desktop.
Save fprochazka/0a0b12fa38b942683581 to your computer and use it in GitHub Desktop.
<?php
class ExtensionTest extends Tester\TestCase
{
public function testMergingMetadata_simple()
{
$compiler = new CompilerMock();
$compiler->addExtension('annotation', new Kdyby\Annotations\DI\AnnotationsExtension());
$compiler->addExtension('doctrine', $doctrine = new OrmExtension());
$compiler->config = array(
'doctrine' => array(
'user' => 'root', 'password' => 'heslo', 'dbname' => 'test',
'metadata' => array(
'KdybyTests\Doctrine\Bar' => new Statement(OrmExtension::ANNOTATION_DRIVER, array(__DIR__ . '/models/lib1')),
'KdybyTests\Doctrine\AnnotationDriver\Something' => new Statement(OrmExtension::ANNOTATION_DRIVER, array(__DIR__ . '/models/AnnotationDriver/Something')),
),
)
);
$doctrine->loadConfiguration();
dump($compiler->getContainerBuilder()->getDefinitions());
}
}
class CompilerMock extends Nette\DI\Compiler
{
/**
* @var Nette\DI\ContainerBuilder
*/
public $containerBuilder;
/**
* @var array
*/
public $config = [];
public function __construct()
{
$this->containerBuilder = new Nette\DI\ContainerBuilder();
$this->containerBuilder->parameters = [
'appDir' => __DIR__ . '/../..',
'wwwDir' => __DIR__ . '/../..',
'tempDir' => TEMP_DIR,
'debugMode' => FALSE,
'productionMode' => TRUE,
];
}
/**
* @return array
*/
public function getConfig()
{
return $this->config;
}
/**
* @return Nette\DI\ContainerBuilder
*/
public function getContainerBuilder()
{
return $this->containerBuilder;
}
}
\run(new ExtensionTest());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment