public canInstantiate ( Nelmio\Alice\FixtureInterface $fixture ) : boolean | ||
$fixture | Nelmio\Alice\FixtureInterface | |
return | boolean |
public function canInstantiate(FixtureInterface $fixture) : bool
{
$constructor = $fixture->getSpecs()->getConstructor();
return null !== $constructor && false === $constructor instanceof NoMethodCall && $constructor->getCaller() instanceof StaticReference;
}
public function testCanInstantiateFixtureWithIfConstructorIsAStaticFactory() { $fixture = new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create(new MethodCallWithReference(new StaticReference('static_reference'), 'fake'))); $this->assertTrue($this->instantiator->canInstantiate($fixture)); }