Neos\Flow\Tests\Unit\Aop\Advice\AroundAdviceTest::invokeDoesNotInvokeTheAdviceIfTheRuntimeEvaluatorReturnsFalse PHP Method

invokeDoesNotInvokeTheAdviceIfTheRuntimeEvaluatorReturnsFalse() public method

    public function invokeDoesNotInvokeTheAdviceIfTheRuntimeEvaluatorReturnsFalse()
    {
        $mockAdviceChain = $this->getMockBuilder(Aop\Advice\AdviceChain::class)->disableOriginalConstructor()->getMock();
        $mockAdviceChain->expects($this->once())->method('proceed')->will($this->returnValue('result'));
        $mockJoinPoint = $this->getMockBuilder(Aop\JoinPointInterface::class)->disableOriginalConstructor()->getMock();
        $mockJoinPoint->expects($this->any())->method('getAdviceChain')->will($this->returnValue($mockAdviceChain));
        $mockAspect = $this->createMock(Fixtures\SomeClass::class);
        $mockAspect->expects($this->never())->method('someMethod');
        $mockObjectManager = $this->getMockBuilder(ObjectManagerInterface::class)->disableOriginalConstructor()->getMock();
        $mockObjectManager->expects($this->any())->method('get')->will($this->returnValue($mockAspect));
        $advice = new Aop\Advice\AroundAdvice('aspectObjectName', 'someMethod', $mockObjectManager, function (Aop\JoinPointInterface $joinPoint) {
            if ($joinPoint !== null) {
                return false;
            }
        });
        $result = $advice->invoke($mockJoinPoint);
        $this->assertEquals($result, 'result', 'The around advice did not return the result value as expected.');
    }