/** * @expectedException \Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationException * @expectedExceptionMessage Instantiated fixture was expected to be an instance of "Nelmio\Alice\Entity\Instantiator\DummyWithFakeNamedConstructor". Got "Nelmio\Alice\Throwable\Exception\Generator\Instantiator\InstantiationExceptionFactory" instead. */ public function testThrowsAnExceptionIfFactoryDoesNotReturnAnInstance() { $fixture = new SimpleFixture('dummy', DummyWithFakeNamedConstructor::class, SpecificationBagFactory::create(new MethodCallWithReference(new StaticReference(DummyWithFakeNamedConstructor::class), 'namedConstruct'))); $this->instantiator->instantiate($fixture, ResolvedFixtureSetFactory::create(), new GenerationContext()); }