createForFlagBagKeyMismatch() public static method

public static createForFlagBagKeyMismatch ( Nelmio\Alice\FixtureInterface $fixture, FlagBag $flags ) : InvalidArgumentException
$fixture Nelmio\Alice\FixtureInterface
$flags Nelmio\Alice\Definition\FlagBag
return InvalidArgumentException
 public function testTestCreateForFlagBagKeyMismatch()
 {
     $exception = InvalidArgumentExceptionFactory::createForFlagBagKeyMismatch(new DummyFixture('foo'), new FlagBag('bar'));
     $this->assertEquals('Expected the fixture ID and the flags key to be the same. Got "foo" and "bar" instead.', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
Ejemplo n.º 2
0
 public function __construct(FixtureInterface $fixture, FlagBag $flags)
 {
     if ($fixture->getId() !== $flags->getKey()) {
         throw InvalidArgumentExceptionFactory::createForFlagBagKeyMismatch($fixture, $flags);
     }
     $this->fixture = clone $fixture;
     $this->flags = $flags;
 }