move to new architecture for test - improve autoloading

This commit is contained in:
Julien Fastré 2017-07-04 15:34:28 +02:00
parent cf40c0dc76
commit 717845f799
15 changed files with 28 additions and 13 deletions

View File

@ -0,0 +1,11 @@
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../../../../../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;

View File

@ -1,19 +1,19 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
set_time_limit(0);
require_once __DIR__.'/../../bootstrap.php';
require_once __DIR__.'/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug; use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
set_time_limit(0);
require __DIR__.'/autoload.php';
$input = new ArgvInput(); $input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); $env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';

View File

@ -14,6 +14,9 @@
"autoload": { "autoload": {
"psr-4": { "Chill\\MainBundle\\": "" } "psr-4": { "Chill\\MainBundle\\": "" }
}, },
"autoload-dev": {
"classmap": [ "Resources/test/Fixtures/App/app/AppKernel.php" ]
},
"authors" : [ "authors" : [
{ {
"name": "Champs-Libres", "name": "Champs-Libres",
@ -57,7 +60,8 @@
] ]
}, },
"extra": { "extra": {
"app-migrations-dir": "Tests/Fixtures/App/DoctrineMigrations", "app-migrations-dir": "Resources/test/Fixtures/App/app/DoctrineMigrations",
"symfony-app-dir": "Tests/Fixtures/App/" "symfony-app-dir": "Tests/Fixtures/App/"
} },
"prefer-stable": true
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./Tests/bootstrap.php" colors="true"> <phpunit bootstrap="./Resources/test/Fixtures/App/app/autoload.php" colors="true">
<testsuites> <testsuites>
<testsuite name="ChillMain test suite"> <testsuite name="ChillMain test suite">
<directory suffix="Test.php">./Tests</directory> <directory suffix="Test.php">./Tests</directory>
@ -17,7 +17,7 @@
</whitelist> </whitelist>
</filter> </filter>
<php> <php>
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/" /> <server name="KERNEL_DIR" value="./Resources/test/Fixtures/App/app" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php> </php>
</phpunit> </phpunit>