Adding Tests

This commit is contained in:
Marc Ducobu 2014-11-07 15:32:21 +01:00
parent bd82733a6c
commit a911c7aeae
12 changed files with 1485 additions and 5 deletions

BIN
Tests/Fixtures/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,37 @@
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
return array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Chill\ReportBundle\ChillReportBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
);
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* @return string
*/
public function getCacheDir()
{
return sys_get_temp_dir().'/ChillReportBundle/cache';
}
/**
* @return string
*/
public function getLogDir()
{
return sys_get_temp_dir().'/ChillReportBundle/logs';
}
}

View File

@ -0,0 +1,12 @@
# config/config.yml
framework:
secret: Not very secret
router: { resource: "%kernel.root_dir%/config/routing.yml" }
form: true
csrf_protection: true
session: ~
default_locale: fr
translator: { fallback: fr }
profiler: { only_exceptions: false }
templating: #required for assetic. Remove if not needed
engines: ['twig']

View File

@ -0,0 +1,7 @@
imports:
- { resource: config.yml } #here we import a config.yml file, this is not required
framework:
test: ~
session:
storage_id: session.storage.filesystem

View File

@ -0,0 +1,7 @@
imports:
- { resource: config.yml } #here we import a config.yml file, this is not required
framework:
test: ~
session:
storage_id: session.storage.filesystem

View File

@ -0,0 +1 @@
routing.yml

View File

@ -0,0 +1,27 @@
#!/usr/bin/env 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\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
if ($debug) {
Debug::enable();
}
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

7
Tests/bootstrap.php Normal file
View File

@ -0,0 +1,7 @@
<?php
if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) {
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}
require $autoloadFile;

View File

@ -5,6 +5,9 @@
"keywords" : ["chill", "social work"],
"license": "AGPL-3.0",
"homepage" : "https://github.com/Chill-project/Report",
"autoload": {
"psr-4": { "Chill\\ReportBundle\\": "" }
},
"authors" : [
{
"name": "Champs-Libres",
@ -23,10 +26,5 @@
"doctrine/orm": "2.5.*@dev",
"doctrine/common": "2.4.*@dev",
"doctrine/doctrine-bundle": "~1.2@dev"
},
"require-dev": {
"symfony/dom-crawler": "2.5",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"symfony/security": "~2.5"
}
}

1363
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

1
console.sh Executable file
View File

@ -0,0 +1 @@
php Tests/Fixtures/App/console $1 $2 $3 $4 $5

20
phpunit.xml.dist Normal file
View File

@ -0,0 +1,20 @@
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
<testsuites>
<testsuite name="ChillMain test suite">
<directory suffix="Test.php">./Tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
<php>
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/" />
</php>
</phpunit>