Skip to content

Commit

Permalink
Fix some tests (work in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
klapaudius committed Oct 9, 2024
1 parent 3cfb456 commit 8286352
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
11 changes: 5 additions & 6 deletions Tests/Controller/AuthorizeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ public function setUp(): void
$this->eventDispatcher
);

/** @var MockObject&Request $request */
$request = $this->getMockBuilder(Request::class)
$this->request = $this->getMockBuilder(Request::class)
->disableOriginalConstructor()
->getMock()
;
Expand All @@ -127,9 +126,6 @@ public function setUp(): void
->disableOriginalConstructor()
->getMock()
;
$request->query = $this->requestQuery;
$request->request = $this->requestRequest;
$this->request = $request;
$this->user = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()
->getMock()
Expand Down Expand Up @@ -374,7 +370,6 @@ public function testAuthorizeActionWillEnsureLogout(): void
->expects($this->exactly(1))
->method('set')
->with('_fos_oauth_server.ensure_logout', true)
->willReturn(null)
;

$propertyReflection = new ReflectionProperty(AuthorizeController::class, 'client');
Expand Down Expand Up @@ -426,6 +421,10 @@ public function testAuthorizeActionWillEnsureLogout(): void
$this->assertEquals($response, $this->instance->authorizeAction($this->request));
}

/**
* @TODO Rewrite this test since Request::$query and Request::$request are now typed with final classes
* Than can't be mocked anymore
*/
public function testAuthorizeActionWillProcessAuthorizationForm(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInter
{
$container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
->setMethods([
->onlyMethods([
'findDefinition',
'getParameterBag',
])
Expand Down Expand Up @@ -201,7 +201,7 @@ public function testProcess(): void
{
$container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
->setMethods([
->onlyMethods([
'findDefinition',
'getParameterBag',
'findTaggedServiceIds',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function setUp(): void
{
$this->container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
->setMethods([
->onlyMethods([
'has',
'getDefinition',
])
Expand Down
2 changes: 1 addition & 1 deletion Tests/FOSOAuthServerBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testConstruction(): void
/** @var ContainerBuilder|\PHPUnit_Framework_MockObject_MockObject $containerBuilder */
$containerBuilder = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
->setMethods([
->onlyMethods([
'getExtension',
'addCompilerPass',
])
Expand Down

0 comments on commit 8286352

Please sign in to comment.