Implemented testRightAppliesToAll for SecureSourceChecker

This commit is contained in:
Kevin Frantz 2019-02-16 16:26:14 +01:00
parent 256e37ccd5
commit 956a717610

View File

@ -102,4 +102,22 @@ class SecureSourceCheckerTest extends TestCase
$this->expectException(SourceAccessDenied::class);
$this->securerSourceChecker->hasPermission($requestedRight);
}
public function testRightAppliesToAll(): void
{
$right = new Right();
$right->setLayer(LayerType::SOURCE);
$right->setCrud(CRUDType::READ);
$right->setReciever($this->recieverSource);
$right->setSource($this->source);
$this->assertFalse($this->securerSourceChecker->hasPermission($right));
$requestedRight = new Right();
$requestedRight->setLayer(LayerType::SOURCE);
$requestedRight->setCrud(CRUDType::READ);
$requestedRight->setSource($this->source);
$this->source->getLaw()->getRights()->add($requestedRight);
$this->assertTrue($this->securerSourceChecker->hasPermission($right));
$requestedRight->setReciever($this->createSourceMock());
$this->assertFalse($this->securerSourceChecker->hasPermission($right));
}
}