Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests compatible with PHPUnit 8 #664

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Tests/Command/CleanCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ class CleanCommandTest extends \PHPUnit\Framework\TestCase
private $command;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|TokenManagerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|TokenManagerInterface
*/
private $accessTokenManager;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|TokenManagerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|TokenManagerInterface
*/
private $refreshTokenManager;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|AuthCodeManagerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|AuthCodeManagerInterface
*/
private $authCodeManager;

Expand All @@ -64,7 +64,7 @@ protected function setUp(): void
/**
* Delete expired tokens for provided classes.
*/
public function testItShouldRemoveExpiredToken()
public function testItShouldRemoveExpiredToken(): void
{
$expiredAccessTokens = 5;
$this->accessTokenManager
Expand Down Expand Up @@ -100,7 +100,7 @@ public function testItShouldRemoveExpiredToken()
/**
* Skip classes for deleting expired tokens that do not implement AuthCodeManagerInterface or TokenManagerInterface.
*/
public function testItShouldNotRemoveExpiredTokensForOtherClasses()
public function testItShouldNotRemoveExpiredTokensForOtherClasses(): void
{
$this->markTestIncomplete('Needs a better way of testing this');

Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/CreateClientCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateClientCommandTest extends TestCase
private $command;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ClientManagerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|ClientManagerInterface
*/
private $clientManager;

Expand All @@ -53,7 +53,7 @@ protected function setUp(): void
*
* @param string $client a fully qualified class name
*/
public function testItShouldCreateClient($client)
public function testItShouldCreateClient($client): void
{
$this
->clientManager
Expand Down
50 changes: 25 additions & 25 deletions Tests/Controller/AuthorizeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,52 +38,52 @@
class AuthorizeControllerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|RequestStack
* @var \PHPUnit\Framework\MockObject\MockObject|RequestStack
*/
protected $requestStack;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|SessionInterface
* @var \PHPUnit\Framework\MockObject\MockObject|SessionInterface
*/
protected $session;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Form
* @var \PHPUnit\Framework\MockObject\MockObject|Form
*/
protected $form;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|AuthorizeFormHandler
* @var \PHPUnit\Framework\MockObject\MockObject|AuthorizeFormHandler
*/
protected $authorizeFormHandler;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|OAuth2
* @var \PHPUnit\Framework\MockObject\MockObject|OAuth2
*/
protected $oAuth2Server;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|TokenStorageInterface
* @var \PHPUnit\Framework\MockObject\MockObject|TokenStorageInterface
*/
protected $tokenStorage;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|TwigEnvironment
* @var \PHPUnit\Framework\MockObject\MockObject|TwigEnvironment
*/
protected $twig;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|UrlGeneratorInterface
* @var \PHPUnit\Framework\MockObject\MockObject|UrlGeneratorInterface
*/
protected $router;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ClientManagerInterface
* @var \PHPUnit\Framework\MockObject\MockObject|ClientManagerInterface
*/
protected $clientManager;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|EventDispatcherInterface
* @var \PHPUnit\Framework\MockObject\MockObject|EventDispatcherInterface
*/
protected $eventDispatcher;

Expand All @@ -93,46 +93,46 @@ class AuthorizeControllerTest extends \PHPUnit\Framework\TestCase
protected $instance;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|Request
* @var \PHPUnit\Framework\MockObject\MockObject|Request
*/
protected $request;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ParameterBag
* @var \PHPUnit\Framework\MockObject\MockObject|ParameterBag
*/
protected $requestQuery;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ParameterBag
* @var \PHPUnit\Framework\MockObject\MockObject|ParameterBag
*/
protected $requestRequest;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|UserInterface
* @var \PHPUnit\Framework\MockObject\MockObject|UserInterface
*/
protected $user;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ClientInterface
* @var \PHPUnit\Framework\MockObject\MockObject|ClientInterface
*/
protected $client;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|PreAuthorizationEvent
* @var \PHPUnit\Framework\MockObject\MockObject|PreAuthorizationEvent
*/
protected $preAuthorizationEvent;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|PostAuthorizationEvent
* @var \PHPUnit\Framework\MockObject\MockObject|PostAuthorizationEvent
*/
protected $postAuthorizationEvent;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|FormView
* @var \PHPUnit\Framework\MockObject\MockObject|FormView
*/
protected $formView;

public function setUp()
public function setUp(): void
{
$this->requestStack = $this->getMockBuilder(RequestStack::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -188,7 +188,7 @@ public function setUp()
$this->session
);

/** @var \PHPUnit_Framework_MockObject_MockObject&Request $request */
/** @var \PHPUnit\Framework\MockObject\MockObject&Request $request */
$request = $this->getMockBuilder(Request::class)
->disableOriginalConstructor()
->getMock()
Expand Down Expand Up @@ -228,7 +228,7 @@ public function setUp()
parent::setUp();
}

public function testAuthorizeActionWillThrowAccessDeniedException()
public function testAuthorizeActionWillThrowAccessDeniedException(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
->disableOriginalConstructor()
Expand All @@ -253,7 +253,7 @@ public function testAuthorizeActionWillThrowAccessDeniedException()
$this->instance->authorizeAction($this->request);
}

public function testAuthorizeActionWillRenderTemplate()
public function testAuthorizeActionWillRenderTemplate(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -325,7 +325,7 @@ public function testAuthorizeActionWillRenderTemplate()
$this->assertSame($responseBody, $this->instance->authorizeAction($this->request)->getContent());
}

public function testAuthorizeActionWillFinishClientAuthorization()
public function testAuthorizeActionWillFinishClientAuthorization(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -394,7 +394,7 @@ public function testAuthorizeActionWillFinishClientAuthorization()
$this->assertSame($response, $this->instance->authorizeAction($this->request));
}

public function testAuthorizeActionWillEnsureLogout()
public function testAuthorizeActionWillEnsureLogout(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -480,7 +480,7 @@ public function testAuthorizeActionWillEnsureLogout()
$this->assertSame($responseBody, $this->instance->authorizeAction($this->request)->getContent());
}

public function testAuthorizeActionWillProcessAuthorizationForm()
public function testAuthorizeActionWillProcessAuthorizationForm(): void
{
$token = $this->getMockBuilder(TokenInterface::class)
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class GrantExtensionsCompilerPassTest extends \PHPUnit\Framework\TestCase
*/
protected $instance;

public function setUp()
public function setUp(): void
{
$this->instance = new GrantExtensionsCompilerPass();

parent::setUp();
}

public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInterface()
public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInterface(): void
{
$container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -93,7 +93,7 @@ public function testProcessWillNotDoAnythingIfTheStorageDoesNotImplementOurInter
$this->assertNull($this->instance->process($container));
}

public function testProcessWillFailIfUriIsEmpty()
public function testProcessWillFailIfUriIsEmpty(): void
{
$container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
Expand Down Expand Up @@ -197,7 +197,7 @@ public function testProcessWillFailIfUriIsEmpty()
$this->assertNull($this->instance->process($container));
}

public function testProcess()
public function testProcess(): void
{
$container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class RequestStackCompilerPassTest extends \PHPUnit\Framework\TestCase
protected $instance;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|ContainerBuilder
* @var \PHPUnit\Framework\MockObject\MockObject|ContainerBuilder
*/
protected $container;

public function setUp()
public function setUp(): void
{
$this->container = $this->getMockBuilder(ContainerBuilder::class)
->disableOriginalConstructor()
Expand All @@ -51,7 +51,7 @@ public function setUp()
parent::setUp();
}

public function testProcessWithoutRequestStackDoesNothing()
public function testProcessWithoutRequestStackDoesNothing(): void
{
$this->container
->expects($this->once())
Expand All @@ -63,7 +63,7 @@ public function testProcessWithoutRequestStackDoesNothing()
$this->assertNull($this->instance->process($this->container));
}

public function testProcess()
public function testProcess(): void
{
$this->container
->expects($this->once())
Expand Down
16 changes: 8 additions & 8 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

class ConfigurationTest extends \PHPUnit\Framework\TestCase
{
public function testShouldImplementConfigurationInterface()
public function testShouldImplementConfigurationInterface(): void
{
$rc = new \ReflectionClass(Configuration::class);

$this->assertTrue($rc->implementsInterface(ConfigurationInterface::class));
}

public function testCouldBeConstructedWithoutAnyArguments()
public function testCouldBeConstructedWithoutAnyArguments(): void
{
try {
new Configuration();
Expand All @@ -39,7 +39,7 @@ public function testCouldBeConstructedWithoutAnyArguments()
}
}

public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed()
public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand Down Expand Up @@ -69,7 +69,7 @@ public function testShouldNotMandatoryServiceIfNotCustomDriverIsUsed()
], $config);
}

public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed()
public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand All @@ -86,7 +86,7 @@ public function testShouldMakeClientManagerServiceMandatoryIfCustomDriverIsUsed(
]]);
}

public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIsUsed()
public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand All @@ -106,7 +106,7 @@ public function testShouldMakeAccessTokenManagerServiceMandatoryIfCustomDriverIs
]]);
}

public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverIsUsed()
public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverIsUsed(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand All @@ -127,7 +127,7 @@ public function testShouldMakeRefreshTokenManagerServiceMandatoryIfCustomDriverI
]]);
}

public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUsed()
public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUsed(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand All @@ -149,7 +149,7 @@ public function testShouldMakeAuthCodeManagerServiceMandatoryIfCustomDriverIsUse
]]);
}

public function testShouldLoadCustomDriverConfig()
public function testShouldLoadCustomDriverConfig(): void
{
$configuration = new Configuration();
$processor = new Processor();
Expand Down
Loading