예제 #1
0
    public function testIsAllowed_withInheritedException_toWork()
    {
        $yaml = <<<EOT
ArchInspec:
    - deny: First\\Package
ArchInspec\\Sub:
    - allow: First\\Package
ArchInspec\\Sub\\Deeply\\Nested:
    - deny: First\\Package
EOT;
        $inspector = new Inspector();
        $inspector->load($yaml);
        $this->assertFalse($inspector->isAllowed('ArchInspec', 'First\\Package')->isAllowed());
        $this->assertTrue($inspector->isAllowed('ArchInspec\\Sub', 'First\\Package')->isAllowed());
        $this->assertTrue($inspector->isAllowed('ArchInspec\\Sub\\Deeply', 'First\\Package')->isAllowed());
        $this->assertFalse($inspector->isAllowed('ArchInspec\\Sub\\Deeply\\Nested', 'First\\Package')->isAllowed());
    }