Skip to content

Instantly share code, notes, and snippets.

@everzet
Created June 27, 2011 12:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everzet/1048748 to your computer and use it in GitHub Desktop.
Save everzet/1048748 to your computer and use it in GitHub Desktop.
How to configure BehatBundle and MinkBundle to run goutte sessions efficiently
<?php
// 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 (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel('test', true);
$kernel->handle(Request::createFromGlobals())->send();
<?php
public function registerBundles()
{
// ...
if ('test' === $this->getEnvironment()) {
$bundles[] = new Behat\MinkBundle\BehatMinkBundle();
$bundles[] = new Behat\BehatBundle\BehatBundle();
}
// ...
}
imports:
- { resource: config_dev.yml }
framework:
test: ~
session:
storage_id: session.storage.filesystem
web_profiler:
toolbar: false
intercept_redirects: false
behat_mink:
base_url: http://your_app.dev/app_test.php/
default_session: goutte
goutte: ~
sahi: ~
behat: ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment