Skip to content

Instantly share code, notes, and snippets.

@K-Phoen
Created January 9, 2013 15:38
Show Gist options
  • Save K-Phoen/4494091 to your computer and use it in GitHub Desktop.
Save K-Phoen/4494091 to your computer and use it in GitHub Desktop.
Functional tests for standalone Symfony2 bundles
<?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(),
// register the other bundles your tests depend on
// and don't forget your own bunde!
new ACME\HelloBundle\AcmeHelloBundle(),
);
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
/**
* @return string
*/
public function getCacheDir()
{
return sys_get_temp_dir().'/AcmeHelloBundle/cache';
}
/**
* @return string
*/
public function getLogDir()
{
return sys_get_temp_dir().'/AcmeHelloBundle/logs';
}
}
{
"name": "acme/hello-bundle",
"type": "symfony-bundle",
"require": {
"symfony/symfony": "2.1.*",
"sensio/framework-extra-bundle": "2.1.x"
},
"require-dev": {
"doctrine/orm": "*",
"doctrine/doctrine-bundle": "*",
"symfony/assetic-bundle": "*",
"behat/behat-bundle": "*",
"behat/mink-bundle": "*",
"behat/sahi-client": "*"
},
"autoload": {
"psr-0": { "Acme\\HelloBundle": "" }
},
"target-dir": "Acme/HelloBundle"
}
framework:
secret: Hell yeah!
router: { resource: "%kernel.root_dir%/config/routing.yml" }
form: true
csrf_protection: true
session: ~
default_locale: en
translator: { fallback: en }
profiler: { only_exceptions: false }
imports:
- { resource: config.yml }
framework:
test: ~
session:
storage_id: session.storage.filesystem
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="Tests/bootstrap.php"
>
<testsuites>
<testsuite name="HelloBundle Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<php>
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/app" />
</php>
</phpunit>
hello_bundle:
resource: "@ACMEHelloBundle/Resources/config/routing.yml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment