How can I pass Assertions in PHP Behat?

How can I pass Assertions in PHP Behat ?

Hi Mark!

Behat doesn’t come with its own assertion tool. However, you can use any proper assertion tool. Proper assertion tool is a library, in which assertions throw exceptions on fail.

For example, if you’re familiar with PHPUnit, you can use its assertions in Behat.

Shown below is an example of using Assertions in PHP Behat.

<?php

use Behat\Behat\Context\BehatContext;
use Behat\Gherkin\Node\PyStringNode;

require_once 'PHPUnit/Autoload.php';
require_once 'PHPUnit/Framework/Assert/Functions.php';

class FeatureContext extends BehatContext
{
/**
* @Then /^I should get:$/
*/
public function iShouldGet(PyStringNode $string)
{
assertEquals($string->getRaw(), $this->output);
}
}