Skip to content

Instantly share code, notes, and snippets.

@yuriteixeira
Forked from jakzal/BehatTest.php
Created December 16, 2012 20:16
Show Gist options
  • Save yuriteixeira/4312370 to your computer and use it in GitHub Desktop.
Save yuriteixeira/4312370 to your computer and use it in GitHub Desktop.
A quick and dirty PHPUnit test case that runs behat, making code coverage reports being possible!
<?php
use Symfony\Component\Console\Input\ArrayInput;
use Behat\Behat\Console\BehatApplication;
use Symfony\Component\Console\Output\ConsoleOutput;
class BehatTest extends \PHPUnit_Framework_TestCase
{
public function testThatBehatScenariosMeetAcceptanceCriteria()
{
try {
$input = new ArrayInput(array('--format' => 'progress', '-v' => ''));
$output = new ConsoleOutput();
$app = new BehatApplication('DEV');
$app->setAutoExit(false);
$result = $app->run($input, $output);
$this->assertEquals(0, $result);
} catch (\Exception $exception) {
$this->fail($exception->getMessage());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment