Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForFlagBagKeyMismatch PHP Method

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 static function createForFlagBagKeyMismatch(FixtureInterface $fixture, FlagBag $flags) : \InvalidArgumentException
    {
        return new \InvalidArgumentException(sprintf('Expected the fixture ID and the flags key to be the same. Got "%s" and "%s" instead.', $fixture->getId(), $flags->getKey()));
    }

Usage Example

 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());
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForFlagBagKeyMismatch