/** * {@inheritDoc} */ public function canInstantiate(Fixture $fixture) { return !$fixture->shouldUseConstructor() && !version_compare(PHP_VERSION, '5.4', '<'); }
/** * {@inheritDoc} */ public function canInstantiate(Fixture $fixture) { $refl = new \ReflectionMethod($fixture->getClass(), '__construct'); return $fixture->shouldUseConstructor() && $refl->getNumberOfRequiredParameters() <= count($fixture->getConstructorArgs()); }
/** * {@inheritDoc} */ public function canInstantiate(Fixture $fixture) { $reflConstruct = new \ReflectionMethod($fixture->getClass(), '__construct'); return !$reflConstruct->isPublic() || !$fixture->shouldUseConstructor() && !version_compare(PHP_VERSION, '5.4', '<'); }
public function testShouldUseConstructorWillReturnTrueIfTheConstructorSpecIsDefined() { $fixture = new Fixture(self::USER, 'user', array('__construct' => array('1', '2')), null); $this->assertTrue($fixture->shouldUseConstructor()); }