Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. namespace Thengine\Behat\Context\Domain\Tariff\Model;
  6.  
  7. use Behat\Behat\Context\Context
  8. use Thengine\Domain\Tariff\Model\Tariff;
  9. use Thengine\Domain\Tariff\Model\TariffCategory;
  10. use Thengine\Domain\Tariff\Exception\CannotRemoveCategoryException;
  11. use Thengine\Test\Assert\Exception\ExpectationFailedException;
  12.  
  13. final class TariffContext implements Context
  14. {
  15. // ..
  16.  
  17. /**
  18. * @Then I should not be able to remove the tariff ":tariff" from category ":tariffCategory"
  19. */
  20. public function expectCannotRemoveCategoryException(Tariff $tariff, TariffCategory $tariffCategory)
  21. {
  22. $this->manager->refresh($tariff);
  23. $this->manager->refresh($tariffCategory);
  24.  
  25. try {
  26. $tariffCategory->removeTariff($tariff);
  27.  
  28. throw new ExpectationFailedException('The category should not be removable.');
  29. } catch (CannotRemoveCategoryException $e) {
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement