Skip to content

Instantly share code, notes, and snippets.

Last active Mar 26, 2017
What would you like to do?
Behat: Expect exceptions
namespace Thengine\Behat\Context\Domain\Tariff\Model;
use Behat\Behat\Context\Context;
use Thengine\Domain\Tariff\Model\Tariff;
use Thengine\Domain\Tariff\Model\TariffCategory;
use Thengine\Domain\Tariff\Exception\CannotRemoveCategoryException;
use Thengine\Test\Assert\Exception\ExpectationFailedException;
final class TariffContext implements Context
// ..
* @Then I should not be able to remove the tariff ":tariff" from category ":tariffCategory"
public function expectCannotRemoveCategoryException(Tariff $tariff, TariffCategory $tariffCategory)
try {
throw new ExpectationFailedException('The category should not be removable.');
} catch (CannotRemoveCategoryException $e) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment