This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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