Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationExceptionFactory::createForNonPublicConstructor PHP Method

createForNonPublicConstructor() public static method

public static createForNonPublicConstructor ( Nelmio\Alice\FixtureInterface $fixture ) : InstantiationException
$fixture Nelmio\Alice\FixtureInterface
return InstantiationException
    public static function createForNonPublicConstructor(FixtureInterface $fixture) : InstantiationException
    {
        return new InstantiationException(sprintf('Could not instantiate "%s", the constructor of "%s" is not public.', $fixture->getId(), $fixture->getClassName()));
    }

Usage Example

 public function testTestCreateForNonPublicConstructor()
 {
     $exception = InstantiationExceptionFactory::createForNonPublicConstructor(new SimpleFixture('foo', 'Dummy', SpecificationBagFactory::create()));
     $this->assertEquals('Could not instantiate "foo", the constructor of "Dummy" is not public.', $exception->getMessage());
     $this->assertEquals(0, $exception->getCode());
     $this->assertNull($exception->getPrevious());
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationExceptionFactory::createForNonPublicConstructor