Matthias\SymfonyServiceDefinitionValidator\Tests\ArgumentValidatorTest::testFailsWhenResultOfExpressionIsNullButNullIsNotAllowed PHP Метод

testFailsWhenResultOfExpressionIsNullButNullIsNotAllowed() публичный Метод

    public function testFailsWhenResultOfExpressionIsNullButNullIsNotAllowed()
    {
        $this->skipTestIfExpressionsAreNotAvailable();
        $class = 'Matthias\\SymfonyServiceDefinitionValidator\\Tests\\Fixtures\\ClassWithTypeHintedOptionalConstructorArgument';
        $parameter = new \ReflectionParameter(array($class, '__construct'), 'expected');
        $argument = new Expression('null');
        $validator = new ArgumentValidator(new ContainerBuilder(), $this->createMockResultingClassResolver());
        try {
            $validator->validate($parameter, $argument);
        } catch (TypeHintMismatchException $exception) {
            $this->fail('null argument should be allowed');
        }
    }