Nelmio\Alice\Generator\Instantiator\Chainable\NoCallerMethodCallInstantiator::canInstantiate PHP Method

canInstantiate() public method

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 && null === $constructor->getCaller();
    }

Usage Example

 public function testCanInstantiateFixtureWithIfConstructorIsAMalformedFactory()
 {
     $fixture = new SimpleFixture('dummy', 'Dummy', SpecificationBagFactory::create(new SimpleMethodCall('fake')));
     $this->assertTrue($this->instantiator->canInstantiate($fixture));
 }
NoCallerMethodCallInstantiator