function it_throws_an_exception_if_trying_to_another_fixture_with_the_same_name(FixtureInterface $fixture, FixtureInterface $anotherFixture) { $fixture->getName()->willReturn('fixture'); $anotherFixture->getName()->willReturn('fixture'); $this->addFixture($fixture); $this->shouldThrow(\InvalidArgumentException::class)->during('addFixture', [$fixture]); $this->shouldThrow(\InvalidArgumentException::class)->during('addFixture', [$anotherFixture]); }
function it_logs_fixture_name_on_before_fixture_event(LoggerInterface $logger, SuiteInterface $suite, FixtureInterface $fixture) { $fixture->getName()->willReturn('uber_fixture'); $logger->notice(Argument::that(function ($argument) use($fixture) { return false !== strpos($argument, $fixture->getWrappedObject()->getName()); }))->shouldBeCalled(); $this->beforeFixture(new FixtureEvent($suite->getWrappedObject(), $fixture->getWrappedObject(), []), []); }
/** * @param FixtureInterface $fixture */ public function addFixture(FixtureInterface $fixture) { Assert::keyNotExists($this->fixtures, $fixture->getName(), 'Fixture with name "%s" is already registered.'); $this->fixtures[$fixture->getName()] = $fixture; }