/** * @Then I should not be able to choose :name */ public function iShouldNotBeAbleToChoose($name) { try { $this->createPage->chooseName($name); } catch (ElementNotFoundException $exception) { return; } throw new \DomainException('Choose name should throw an exception!'); }
function it_throws_exception_if_country_name_can_be_chosen_again(CreatePageInterface $countryCreatePage) { $countryCreatePage->chooseName('France')->willThrow(\Exception::class); $this->shouldThrow(\Exception::class)->during('iShouldNotBeAbleToChoose', ['France']); }
/** * @When I add it */ public function iAddIt() { $this->createPage->create(); }
function it_adds_a_country(CreatePageInterface $countryCreatePage) { $countryCreatePage->create()->shouldBeCalled(); $this->iAddIt(); }