Skip to content

Instantly share code, notes, and snippets.

@sotarok
Created February 19, 2012 19:00
Show Gist options
  • Save sotarok/1865194 to your computer and use it in GitHub Desktop.
Save sotarok/1865194 to your computer and use it in GitHub Desktop.
Running Behat in the Test Case of PHPUnit on Non-Symfony Application.
<?php
/**
*
* @forked https://gist.github.com/1298503
*/
require_once 'behat/autoload.php';
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Behat\Behat\Console\BehatApplication;
class BehatTest
extends \PHPUnit_Framework_TestCase
{
/**
* @group behat
*/
public function testBehat()
{
try {
$input = new ArrayInput(array(
'--format' => 'progress'
));
$output = new ConsoleOutput();
$app = new BehatApplication('unknown');
$app->setAutoExit(false);
$result = $app->run($input, $output);
$this->assertEquals(0, $result);
} catch (\Exception $e) {
$this->fail($e->getMessage());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment