Neos\Flow\Tests\Unit\ObjectManagement\Proxy\ProxyMethodTest::buildMethodDocumentationAddsAllExpectedAnnotations PHP Метод

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

    public function buildMethodDocumentationAddsAllExpectedAnnotations()
    {
        $validateFoo1 = new Flow\Validate(['value' => 'foo1', 'type' => 'bar1']);
        $validateFoo2 = new Flow\Validate(['value' => 'foo2', 'type' => 'bar2']);
        $mockReflectionService = $this->getMockBuilder(ReflectionService::class)->disableOriginalConstructor()->getMock();
        $mockReflectionService->expects($this->any())->method('hasMethod')->will($this->returnValue(true));
        $mockReflectionService->expects($this->any())->method('getMethodTagsValues')->with('My\\Class\\Name', 'myMethod')->will($this->returnValue(['param' => ['string $name']]));
        $mockReflectionService->expects($this->any())->method('getMethodAnnotations')->with('My\\Class\\Name', 'myMethod')->will($this->returnValue([$validateFoo1, $validateFoo2, new Flow\SkipCsrfProtection([])]));
        $mockProxyMethod = $this->getAccessibleMock(ProxyMethod::class, ['dummy'], [], '', false);
        $mockProxyMethod->injectReflectionService($mockReflectionService);
        $methodDocumentation = $mockProxyMethod->_call('buildMethodDocumentation', 'My\\Class\\Name', 'myMethod');
        $expected = '    /**' . chr(10) . '     * Autogenerated Proxy Method' . chr(10) . '     * @param string $name' . chr(10) . '     * @\\Neos\\Flow\\Annotations\\Validate(type="bar1", argumentName="foo1")' . chr(10) . '     * @\\Neos\\Flow\\Annotations\\Validate(type="bar2", argumentName="foo2")' . chr(10) . '     * @\\Neos\\Flow\\Annotations\\SkipCsrfProtection' . chr(10) . '     */' . chr(10);
        $this->assertEquals($expected, $methodDocumentation);
    }