Skip to content

Instantly share code, notes, and snippets.

@martinlindhe
Last active October 30, 2018 23:39
Show Gist options
  • Save martinlindhe/83aa60468671e7cf8bed to your computer and use it in GitHub Desktop.
Save martinlindhe/83aa60468671e7cf8bed to your computer and use it in GitHub Desktop.
run Behat 3 tests as a phpunit script (to include behat in code coverage count)
<?php
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Behat\Behat\ApplicationFactory;
class BehatTest extends TestCase
{
/**
* @group Behat
*/
public function testRunBehat()
{
$behat = (new ApplicationFactory)->createApplication();
$behat->setAutoExit(false);
$input = new ArrayInput(['behat', '--format', 'progress']);
$output = new ConsoleOutput();
$result = $behat->run($input, $output);
$this->assertEquals(0, $result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment