/** * @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 choose :countryName */ public function iChoose($countryName) { $this->createPage->chooseName($countryName); }
function it_chooses_name_in_creation_form(CreatePageInterface $countryCreatePage) { $countryCreatePage->chooseName('France')->shouldBeCalled(); $this->iChoose('France'); }