chore: upgrade phpunit to 12.5
This commit is contained in:
1 parent
da039d0527
commit
849da8d471
53 files changed
+832
-856
No files matched your search
@@ -9,7 +9,7 @@ use App\Entity\Teamer;
|
||||
use App\Entity\Upload;
|
||||
use App\Entity\User;
|
||||
use App\Security\Voter\UploadVoter;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\MockObject\Stub;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
@@ -22,11 +22,11 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
*/
|
||||
class UploadVoterTest extends TestCase
|
||||
{
|
||||
private Security&MockObject $security;
|
||||
private Security&Stub $security;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->security = $this->createMock(Security::class);
|
||||
$this->security = $this->createStub(Security::class);
|
||||
$this->security
|
||||
->method('isGranted')
|
||||
->willReturnCallback(static fn (string $role): bool => 'ROLE_TEAMER' === $role)
|
||||
@@ -68,9 +68,8 @@ class UploadVoterTest extends TestCase
|
||||
/**
|
||||
* Downloading is all the new rule grants: the file stays the office's, so the teamer it was
|
||||
* issued to may not delete it or reach it through any other attribute.
|
||||
*
|
||||
* @dataProvider otherAttributes
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('otherAttributes')]
|
||||
public function testTheNewRuleGrantsNothingButDownloading(string $attribute): void
|
||||
{
|
||||
$teamer = new Teamer();
|
||||
@@ -124,7 +123,7 @@ class UploadVoterTest extends TestCase
|
||||
|
||||
private function vote(string $attribute, Upload $upload, Teamer $teamer): int
|
||||
{
|
||||
$token = $this->createMock(TokenInterface::class);
|
||||
$token = $this->createStub(TokenInterface::class);
|
||||
$token->method('getUser')->willReturn((new User())->setTeamer($teamer));
|
||||
|
||||
return (new UploadVoter($this->security))->vote($token, $upload, [$attribute]);
|
||||
|
||||
Reference in new issue
Block a user