createMock(SecurityPolicyInterface::class); $policy1->expects(self::once())->method('checkSecurity')->with(['tag'], ['filter'], ['function']); $policy2 = $this->createMock(SecurityPolicyInterface::class); $policy2->expects(self::once())->method('checkSecurity')->with(['tag'], ['filter'], ['function']); $sut = new ChainPolicy(); $sut->addPolicy($policy1); $sut->addPolicy($policy2); $sut->checkSecurity(['tag'], ['filter'], ['function']); } public function testCheckMethodAllowed(): void { $obj = new \stdClass(); $policy1 = $this->createMock(SecurityPolicyInterface::class); $policy1->expects(self::once())->method('checkMethodAllowed')->with($obj, 'method'); $policy2 = $this->createMock(SecurityPolicyInterface::class); $policy2->expects(self::once())->method('checkMethodAllowed')->with($obj, 'method'); $sut = new ChainPolicy(); $sut->addPolicy($policy1); $sut->addPolicy($policy2); $sut->checkMethodAllowed($obj, 'method'); } public function testCheckPropertyAllowed(): void { $obj = new \stdClass(); $policy1 = $this->createMock(SecurityPolicyInterface::class); $policy1->expects(self::once())->method('checkPropertyAllowed')->with($obj, 'property'); $policy2 = $this->createMock(SecurityPolicyInterface::class); $policy2->expects(self::once())->method('checkPropertyAllowed')->with($obj, 'property'); $sut = new ChainPolicy(); $sut->addPolicy($policy1); $sut->addPolicy($policy2); $sut->checkPropertyAllowed($obj, 'property'); } }