Tester bootstrap error in OrmExtension->processMetadataDriver()

Notice: This thread is very old.
Čamo
Member | 786
+
0
-

Hello,
I am starting with Tester and I need help with some Doctrine exception.
If I include bootstrap.php to test file it throws me this:

-- FAILED: tests\app\test.phpt
   Exited with error code 255 (expected 0)
   Nette\Utils\AssertionException: The metadata path expects to be an existing directory, C:\Apache24\htdocs\ndoctrine\tests/model given.

   in Doctrine\DI\OrmExtension.php(480)
   in Doctrine\DI\OrmExtension.php(301) Kdyby\Doctrine\DI\OrmExtension->processMetadataDriver()
   in Doctrine\DI\OrmExtension.php(166) Kdyby\Doctrine\DI\OrmExtension->processEntityManager()
   in src\DI\Compiler.php(178) Kdyby\Doctrine\DI\OrmExtension->loadConfiguration()
   in src\DI\Compiler.php(137) Nette\DI\Compiler->processExtensions()
   in src\Bootstrap\Configurator.php(267) Nette\DI\Compiler->compile()
   in [internal function]Nette\Configurator->generateContainer()
   in src\DI\ContainerLoader.php(111) call_user_func_array()
   in src\DI\ContainerLoader.php(76) Nette\DI\ContainerLoader->generate()
   in src\DI\ContainerLoader.php(41) Nette\DI\ContainerLoader->loadFile()
   in src\Bootstrap\Configurator.php(221) Nette\DI\ContainerLoader->load()
   in ndoctrine\tests\bootstrap.php(16) Nette\Configurator->createContainer()
   in tests\app\test.phpt(17) require()


FAILURES! (1 test, 1 failure, 0.2 seconds)

I have no idea what happened.

EDIT:
I founded out it is related with config.local.neon directive. If I remove it it works.

metadata:
        App: %appDir%/model

But what is wrong with that?

Last edited by Čamo (2016-02-14 00:54)

jiri.pudil
Nette Blogger | 1028
+
0
-

That's an unfortunate side-effect of how Nette locates %appDir% automatically. You have to set it to a proper path manually when creating the container:

$configurator = new Nette\Configurator();
$configurator->addParameters([
	'appDir' => __DIR__ . '/../app',
]);

Last edited by jiri.pudil (2016-02-14 01:55)

Čamo
Member | 786
+
0
-

Thank you. I leave it without model in path.