public static createForInvalidConstructorMethod ( string $method ) : InvalidArgumentException | ||
$method | string | |
Результат | InvalidArgumentException |
/** * @param FixtureInterface $scope * @param string $method * * @return array The first element is a ServiceReferenceInterface ($caller) and the second a string ($method) */ private function getCallerReference(FixtureInterface $scope, string $method) : array { if (false === strpos($method, '::')) { return [new StaticReference($scope->getClassName()), $method]; } $explodedMethod = explode('::', $method); if (2 < count($explodedMethod)) { throw InvalidArgumentExceptionFactory::createForInvalidConstructorMethod($method); } list($caller, $method) = $explodedMethod; if (0 === strpos($caller, '@')) { return [new InstantiatedReference(substr($caller, 1)), $method]; } return [new StaticReference($caller), $method]; }
public function testTestCreateForInvalidConstructorMethod() { $exception = InvalidArgumentExceptionFactory::createForInvalidConstructorMethod('foo'); $this->assertEquals('Invalid constructor method "foo".', $exception->getMessage()); $this->assertEquals(0, $exception->getCode()); $this->assertNull($exception->getPrevious()); }