injectSystemLogger() public method

public injectSystemLogger ( Neos\Flow\Log\SystemLoggerInterface $systemLogger ) : void
$systemLogger Neos\Flow\Log\SystemLoggerInterface
return void
    /**
     * @test
     */
    public function matchesChecksTheAvailablityOfAnArgumentNameIfArgumentConstraintsHaveBeenConfigured()
    {
        $className = 'TestClass' . md5(uniqid(mt_rand(), true));
        eval('
			class ' . $className . " {\n\t\t\t\tpublic function somePublicMethod(\$arg1) {}\n\t\t\t\tpublic function someOtherPublicMethod(\$arg1, \$arg2 = 'default') {}\n\t\t\t\tpublic function someThirdMethod(\$arg1, \$arg2, \$arg3 = 'default') {}\n\t\t\t}");
        $mockReflectionService = $this->createMock(ReflectionService::class);
        $mockReflectionService->expects($this->exactly(3))->method('getMethodParameters')->will($this->onConsecutiveCalls(['arg1' => []], ['arg1' => [], 'arg2' => []], ['arg1' => [], 'arg2' => [], 'arg3' => []]));
        $mockSystemLogger = $this->getMockBuilder(\Neos\Flow\Log\Logger::class)->setMethods(['log'])->getMock();
        $mockSystemLogger->expects($this->once())->method('log')->with($this->equalTo('The argument "arg2" declared in pointcut does not exist in method ' . $className . '->somePublicMethod'));
        $argumentConstraints = ['arg1' => ['operator' => '==', 'value' => 'someValue'], 'arg2.some.sub.object' => ['operator' => '==', 'value' => 'someValue']];
        $methodNameFilter = new Aop\Pointcut\PointcutMethodNameFilter('some.*', null, $argumentConstraints);
        $methodNameFilter->injectReflectionService($mockReflectionService);
        $methodNameFilter->injectSystemLogger($mockSystemLogger);
        $methodNameFilter->matches(__CLASS__, 'somePublicMethod', $className, 1);
        $this->assertTrue($methodNameFilter->matches(__CLASS__, 'someOtherPublicMethod', $className, 1));
        $this->assertTrue($methodNameFilter->matches(__CLASS__, 'someThirdMethod', $className, 1));
    }
 /**
  * Splits the parameters of the pointcut designator "method" into a class
  * and a method part and adds the appropriately configured filters to the
  * filter composite object.
  *
  * @param string $operator The operator
  * @param string $signaturePattern The pattern expression defining the class and method - the "signature"
  * @param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the class and method filter) will be added to this composite object.
  * @return void
  * @throws InvalidPointcutExpressionException if there's an error in the pointcut expression
  */
 protected function parseDesignatorMethod($operator, $signaturePattern, PointcutFilterComposite $pointcutFilterComposite)
 {
     if (strpos($signaturePattern, '->') === false) {
         throw new InvalidPointcutExpressionException('Syntax error: "->" expected in "' . $signaturePattern . '", defined in ' . $this->sourceHint, 1169027339);
     }
     $methodVisibility = $this->getVisibilityFromSignaturePattern($signaturePattern);
     list($classPattern, $methodPattern) = explode('->', $signaturePattern, 2);
     if (strpos($methodPattern, '(') === false) {
         throw new InvalidPointcutExpressionException('Syntax error: "(" expected in "' . $methodPattern . '", defined in ' . $this->sourceHint, 1169144299);
     }
     $matches = [];
     preg_match(self::PATTERN_MATCHMETHODNAMEANDARGUMENTS, $methodPattern, $matches);
     $methodNamePattern = $matches['MethodName'];
     $methodArgumentPattern = $matches['MethodArguments'];
     $methodArgumentConstraints = $this->getArgumentConstraintsFromMethodArgumentsPattern($methodArgumentPattern);
     $classNameFilter = new PointcutClassNameFilter($classPattern);
     $classNameFilter->injectReflectionService($this->reflectionService);
     $methodNameFilter = new PointcutMethodNameFilter($methodNamePattern, $methodVisibility, $methodArgumentConstraints);
     /** @var SystemLoggerInterface $systemLogger */
     $systemLogger = $this->objectManager->get(SystemLoggerInterface::class);
     $methodNameFilter->injectSystemLogger($systemLogger);
     $methodNameFilter->injectReflectionService($this->reflectionService);
     if ($operator !== '&&') {
         $subComposite = new PointcutFilterComposite();
         $subComposite->addFilter('&&', $classNameFilter);
         $subComposite->addFilter('&&', $methodNameFilter);
         $pointcutFilterComposite->addFilter($operator, $subComposite);
     } else {
         $pointcutFilterComposite->addFilter('&&', $classNameFilter);
         $pointcutFilterComposite->addFilter('&&', $methodNameFilter);
     }
 }