/**
* @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));
}