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

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

    public function buildMethodArgumentsArrayCodeRendersCodeForPassingParametersToTheJoinPoint()
    {
        $className = 'TestClass' . md5(uniqid(mt_rand(), true));
        eval('
			class ' . $className . ' {
				public function foo($arg1, array $arg2, \\ArrayObject $arg3, &$arg4, $arg5= "foo", $arg6 = 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' => true, 'array' => false, 'optional' => false, 'allowsNull' => true], 'arg5' => ['position' => 4, 'byReference' => false, 'array' => false, 'optional' => true, 'allowsNull' => true], 'arg6' => ['position' => 5, 'byReference' => false, 'array' => false, 'optional' => true, 'allowsNull' => true]];
        $mockReflectionService = $this->getMockBuilder(ReflectionService::class)->disableOriginalConstructor()->getMock();
        $mockReflectionService->expects($this->any())->method('getMethodParameters')->with($className, 'foo')->will($this->returnValue($methodParameters));
        $expectedCode = "\n                \$methodArguments = [];\n\n                \$methodArguments['arg1'] = \$arg1;\n                \$methodArguments['arg2'] = \$arg2;\n                \$methodArguments['arg3'] = \$arg3;\n                \$methodArguments['arg4'] = &\$arg4;\n                \$methodArguments['arg5'] = \$arg5;\n                \$methodArguments['arg6'] = \$arg6;\n            ";
        $builder = $this->getAccessibleMock(AbstractMethodInterceptorBuilder::class, ['build'], [], '', false);
        $builder->injectReflectionService($mockReflectionService);
        $actualCode = $builder->_call('buildMethodArgumentsArrayCode', $className, 'foo');
        $this->assertSame($expectedCode, $actualCode);
    }