Merge pull request #8094 from wallabag/add-isgranted-to-configcontroller

Add IsGranted to ConfigController
This commit is contained in:
Yassine Guedidi
2025-03-17 09:34:25 +01:00
committed by GitHub
11 changed files with 359 additions and 56 deletions

View File

@ -139,4 +139,18 @@ class MainVoterTest extends TestCase
$this->assertSame(VoterInterface::ACCESS_GRANTED, $this->mainVoter->vote($this->token, null, [MainVoter::CREATE_SITE_CREDENTIALS]));
}
public function testVoteReturnsDeniedForNonUserEditConfig(): void
{
$this->security->method('isGranted')->with('ROLE_USER')->willReturn(false);
$this->assertSame(VoterInterface::ACCESS_DENIED, $this->mainVoter->vote($this->token, null, [MainVoter::EDIT_CONFIG]));
}
public function testVoteReturnsGrantedForUserEditConfig(): void
{
$this->security->method('isGranted')->with('ROLE_USER')->willReturn(true);
$this->assertSame(VoterInterface::ACCESS_GRANTED, $this->mainVoter->vote($this->token, null, [MainVoter::EDIT_CONFIG]));
}
}