Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (44 sloc) 2.15 KB

Code coverage



use Symfony\Component\HttpFoundation\Request;

// start collect coverage from functional tests
require_once  __DIR__ . '/../vendor/behat/mink-bundle/Behat/MinkBundle/Coverage/prepend.php';

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read for more information

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array('', 'fe80::1', '::1'))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('test', true);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$kernel->terminate($request, $response);

// end collect coverage from functional tests
require 'PHPUnit/Extensions/SeleniumCommon/append.php';


        server_name: localhost
        mink.base_url: 'http://%server_name%/test.php'
        mink.coverage_script_url: 'http://%server_name%/bundles/mink/phpunit_coverage.php'


For selenium(2) tests need additional functional in the test:

$this->initTestCoverage(); // Set cookie for selenium test coverage!!!