Checks if the specified class matches with the class tag filter pattern
public matches ( string $className, string $methodName, string $methodDeclaringClassName, mixed $pointcutQueryIdentifier ) : boolean | ||
$className | string | Name of the class to check against |
$methodName | string | Name of the method - not used here |
$methodDeclaringClassName | string | Name of the class the method was originally declared in - not used here |
$pointcutQueryIdentifier | mixed | Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection. |
Результат | boolean | TRUE if the class matches, otherwise FALSE |
/** * @test */ public function matchesTellsIfTheSpecifiedRegularExpressionMatchesTheGivenAnnotation() { $mockReflectionService = $this->createMock(ReflectionService::class, ['getClassAnnotations'], [], '', false, true); $mockReflectionService->expects($this->any())->method('getClassAnnotations')->with('Acme\\Some\\Class', 'Acme\\Some\\Annotation')->will($this->onConsecutiveCalls(['SomeAnnotation'], [])); $filter = new Aop\Pointcut\PointcutClassAnnotatedWithFilter('Acme\\Some\\Annotation'); $filter->injectReflectionService($mockReflectionService); $this->assertTrue($filter->matches('Acme\\Some\\Class', 'foo', 'Acme\\Some\\Other\\Class', 1234)); $this->assertFalse($filter->matches('Acme\\Some\\Class', 'foo', 'Acme\\Some\\Other\\Class', 1234)); }