Skip to content

Commit

Permalink
Clean up PHPUnit warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Sep 10, 2024
1 parent 9dc8a4a commit f7b74d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
namespace PKP\tests\classes\security\authorization;

use APP\core\Application;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\MockObject\MockObject;
use PKP\security\authorization\AuthorizationDecisionManager;
use PKP\security\authorization\AuthorizationPolicy;
use PKP\security\authorization\PolicySet;
use PHPUnit\Framework\Attributes\CoversClass;

#[CoversClass(AuthorizationDecisionManager::class)]
class AuthorizationDecisionManagerTest extends PolicyTestCase
Expand Down Expand Up @@ -110,7 +110,7 @@ public function testDecide()
->getMock();
$permitPolicy->expects($this->any())
->method('effect')
->will($this->returnCallback($this->mockEffect(...)));
->willReturnCallback($this->mockEffect(...));

// deny overrides
// - permit policy
Expand Down Expand Up @@ -160,14 +160,10 @@ public function testCallOnDeny()
// Create a policy with a call-on-deny advice.
/** @var AuthorizationPolicy|MockObject */
$policy = $this->getMockBuilder(AuthorizationPolicy::class)
->addMethods(['callOnDeny'])
->getMock();
$policy->expects($this->once())
->method('callOnDeny')
->will($this->returnCallback($this->mockCallOnDeny(...)));
$callOnDenyAdvice = [
$policy,
'callOnDeny',
$this,
'mockCallOnDeny',
['argument']
];
$policy->setAdvice(AuthorizationPolicy::AUTHORIZATION_ADVICE_CALL_ON_DENY, $callOnDenyAdvice);
Expand Down
2 changes: 1 addition & 1 deletion tests/classes/security/authorization/PolicyTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function getAuthorizationContextManipulationPolicy()
->getMock();
$policy->expects($this->any())
->method('effect')
->will($this->returnCallback($this->mockEffect(...)));
->willReturnCallback($this->mockEffect(...));
$this->authorizationContextManipulationPolicy = $policy;
}
return $this->authorizationContextManipulationPolicy;
Expand Down

0 comments on commit f7b74d5

Please sign in to comment.