Neos\Flow\Tests\Unit\Aop\Builder\AbstractMethodInterceptorBuilderTest::buildSavedConstructorParametersCodeReturnsTheCorrectParametersCode PHP Метод

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

    public function buildSavedConstructorParametersCodeReturnsTheCorrectParametersCode()
    {
        $className = 'TestClass' . md5(uniqid(mt_rand(), true));
        eval('
			class ' . $className . ' {
				public function __construct($arg1, array $arg2, \\ArrayObject $arg3, $arg4= "__construct", $arg5 = TRUE) {}
			}
		');
        $methodParameters = ['arg1' => ['position' => 0, 'byReference' => false, 'array' => false, 'optional' => false, 'allowsNull' => true], 'arg2' => ['position' => 1, 'byReference' => false, 'array' => true, 'optional' => false, 'allowsNull' => true], 'arg3' => ['position' => 2, 'byReference' => false, 'array' => false, 'optional' => false, 'allowsNull' => true], 'arg4' => ['position' => 3, 'byReference' => false, 'array' => false, 'optional' => true, 'allowsNull' => true], 'arg5' => ['position' => 4, 'byReference' => false, 'array' => false, 'optional' => true, 'allowsNull' => true]];
        $mockReflectionService = $this->getMockBuilder(ReflectionService::class)->disableOriginalConstructor()->getMock();
        $mockReflectionService->expects($this->any())->method('getMethodParameters')->with($className, '__construct')->will($this->returnValue($methodParameters));
        $builder = $this->getAccessibleMock(AdvicedConstructorInterceptorBuilder::class, ['dummy'], [], '', false);
        $builder->injectReflectionService($mockReflectionService);
        $expectedCode = '$this->Flow_Aop_Proxy_originalConstructorArguments[\'arg1\'], $this->Flow_Aop_Proxy_originalConstructorArguments[\'arg2\'], $this->Flow_Aop_Proxy_originalConstructorArguments[\'arg3\'], $this->Flow_Aop_Proxy_originalConstructorArguments[\'arg4\'], $this->Flow_Aop_Proxy_originalConstructorArguments[\'arg5\']';
        $actualCode = $builder->_call('buildSavedConstructorParametersCode', $className);
        $this->assertSame($expectedCode, $actualCode);
    }