Skip to content

Commit 1a3b246

Browse files
committed
Issue #419: Bump phpunit to v12.5.23
Signed-off-by: bota <Bota@dotkernel.com>
1 parent 194b96b commit 1a3b246

38 files changed

Lines changed: 386 additions & 353 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"phpstan/phpstan": "^2.1.32",
6565
"phpstan/phpstan-doctrine": "^2.0.11",
6666
"phpstan/phpstan-phpunit": "^2.0.8",
67-
"phpunit/phpunit": "^10.5.58",
67+
"phpunit/phpunit": "^12.5.23",
6868
"roave/security-advisories": "dev-latest",
6969
"symfony/var-dumper": "^7.4.0",
7070
"vincentlanglet/twig-cs-fixer": "^3.11.0"

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
colors="true"
6+
displayDetailsOnPhpunitNotices="true"
7+
displayDetailsOnTestsThatTriggerDeprecations="true"
8+
displayDetailsOnPhpunitDeprecations="true"
69
stopOnError="true">
710
<testsuites>
811
<testsuite name="UnitTests">

test/Unit/Admin/Adapter/AuthenticationAdapterTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AuthenticationAdapterTest extends UnitTest
3030
public function testAccessors(): void
3131
{
3232
$adapter = new AuthenticationAdapter(
33-
$this->createMock(EntityManager::class),
33+
$this->createStub(EntityManager::class),
3434
[]
3535
);
3636

@@ -54,14 +54,14 @@ public function testAccessors(): void
5454
public function testWillNotAuthenticateWithoutValidConfig(): void
5555
{
5656
$adapter = new AuthenticationAdapter(
57-
$this->createMock(EntityManager::class),
57+
$this->createStub(EntityManager::class),
5858
[]
5959
);
6060
$this->expectExceptionMessage('No or invalid param "identity_class" provided.');
6161
$adapter->authenticate();
6262

6363
$adapter = new AuthenticationAdapter(
64-
$this->createMock(EntityManager::class),
64+
$this->createStub(EntityManager::class),
6565
[
6666
'orm_default' => [
6767
'identity_class' => Admin::class,
@@ -72,7 +72,7 @@ public function testWillNotAuthenticateWithoutValidConfig(): void
7272
$adapter->authenticate();
7373

7474
$adapter = new AuthenticationAdapter(
75-
$this->createMock(EntityManager::class),
75+
$this->createStub(EntityManager::class),
7676
[
7777
'orm_default' => [
7878
'identity_class' => Admin::class,
@@ -84,7 +84,7 @@ public function testWillNotAuthenticateWithoutValidConfig(): void
8484
$adapter->authenticate();
8585

8686
$adapter = new AuthenticationAdapter(
87-
$this->createMock(EntityManager::class),
87+
$this->createStub(EntityManager::class),
8888
[
8989
'orm_default' => [
9090
'identity_class' => Admin::class,
@@ -104,7 +104,7 @@ public function testWillNotAuthenticateWithoutValidConfig(): void
104104
public function testWillNotAuthenticateWithInvalidIdentityClassConfig(): void
105105
{
106106
$adapter = new AuthenticationAdapter(
107-
$this->createMock(EntityManager::class),
107+
$this->createStub(EntityManager::class),
108108
[
109109
'orm_default' => [
110110
'identity_class' => Exception::class,
@@ -133,7 +133,7 @@ public function testWillNotAuthenticateWithInvalidIdentityClassConfig(): void
133133
public function testWillNotAuthenticateWithInvalidIdentityPropertyConfig(): void
134134
{
135135
$adapter = new AuthenticationAdapter(
136-
$this->createMock(EntityManager::class),
136+
$this->createStub(EntityManager::class),
137137
[
138138
'orm_default' => [
139139
'identity_class' => Admin::class,

test/Unit/Admin/Delegator/AdminRoleDelegatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AdminRoleDelegatorTest extends UnitTest
2323
*/
2424
public function testInvokeWillSucceedWithoutAdminForm(): void
2525
{
26-
$container = $this->createMock(ContainerInterface::class);
26+
$container = $this->createStub(ContainerInterface::class);
2727

2828
$delegator = (new AdminRoleDelegator())(
2929
$container,
@@ -47,7 +47,7 @@ public function testInvokeWillSucceedWithAdminForm(): void
4747
->method('get')
4848
->with(EntityManagerInterface::class)
4949
->willReturn(
50-
$this->createMock(EntityManagerInterface::class)
50+
$this->createStub(EntityManagerInterface::class)
5151
);
5252

5353
$delegator = (new AdminRoleDelegator())(

test/Unit/Admin/Factory/AuthenticationServiceFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AuthenticationServiceFactoryTest extends UnitTest
2222
*/
2323
public function testWillInvoke(): void
2424
{
25-
$authenticationAdapter = $this->createMock(AuthenticationAdapter::class);
25+
$authenticationAdapter = $this->createStub(AuthenticationAdapter::class);
2626

2727
$container = $this->createMock(ContainerInterface::class);
2828
$container->expects($this->once())

test/Unit/Admin/Handler/Account/GetAccountEditFormHandlerTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ class GetAccountEditFormHandlerTest extends UnitTest
2727
*/
2828
public function testWillReturnHtmlTemplate(): void
2929
{
30-
$adminService = $this->createMock(AdminServiceInterface::class);
31-
$router = $this->createMock(RouterInterface::class);
32-
$template = $this->createMock(TemplateRendererInterface::class);
33-
$authenticationService = $this->createMock(AuthenticationServiceInterface::class);
34-
$accountForm = $this->createMock(AccountForm::class);
35-
$changePasswordForm = $this->createMock(ChangePasswordForm::class);
36-
$messenger = $this->createMock(FlashMessengerInterface::class);
37-
$request = $this->createMock(ServerRequestInterface::class);
38-
$identity = $this->createMock(AdminIdentity::class);
39-
$adminRepository = $this->createMock(AdminRepository::class);
40-
$admin = $this->createMock(Admin::class);
30+
$adminService = $this->createStub(AdminServiceInterface::class);
31+
$router = $this->createStub(RouterInterface::class);
32+
$template = $this->createStub(TemplateRendererInterface::class);
33+
$authenticationService = $this->createStub(AuthenticationServiceInterface::class);
34+
$accountForm = $this->createStub(AccountForm::class);
35+
$changePasswordForm = $this->createStub(ChangePasswordForm::class);
36+
$messenger = $this->createStub(FlashMessengerInterface::class);
37+
$request = $this->createStub(ServerRequestInterface::class);
38+
$identity = $this->createStub(AdminIdentity::class);
39+
$adminRepository = $this->createStub(AdminRepository::class);
40+
$admin = $this->createStub(Admin::class);
4141

4242
$identity->method('getId')->willReturn('test');
4343
$authenticationService->method('getIdentity')->willReturn($identity);

test/Unit/Admin/Handler/Account/GetAccountLoginFormHandlerTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class GetAccountLoginFormHandlerTest extends UnitTest
2323
*/
2424
public function testAdminLoggedWillReturnRedirectResponse(): void
2525
{
26-
$router = $this->createMock(RouterInterface::class);
27-
$template = $this->createMock(TemplateRendererInterface::class);
28-
$authenticationService = $this->createMock(AuthenticationServiceInterface::class);
29-
$messenger = $this->createMock(FlashMessengerInterface::class);
30-
$formsPlugin = $this->createMock(FormsPlugin::class);
31-
$loginForm = $this->createMock(LoginForm::class);
32-
$request = $this->createMock(ServerRequestInterface::class);
26+
$router = $this->createStub(RouterInterface::class);
27+
$template = $this->createStub(TemplateRendererInterface::class);
28+
$authenticationService = $this->createStub(AuthenticationServiceInterface::class);
29+
$messenger = $this->createStub(FlashMessengerInterface::class);
30+
$formsPlugin = $this->createStub(FormsPlugin::class);
31+
$loginForm = $this->createStub(LoginForm::class);
32+
$request = $this->createStub(ServerRequestInterface::class);
3333

3434
$authenticationService->method('hasIdentity')->willReturn(true);
3535

@@ -52,13 +52,13 @@ public function testAdminLoggedWillReturnRedirectResponse(): void
5252
*/
5353
public function testWillReturnHtmlResponse(): void
5454
{
55-
$router = $this->createMock(RouterInterface::class);
56-
$template = $this->createMock(TemplateRendererInterface::class);
57-
$authenticationService = $this->createMock(AuthenticationServiceInterface::class);
58-
$messenger = $this->createMock(FlashMessengerInterface::class);
59-
$formsPlugin = $this->createMock(FormsPlugin::class);
60-
$loginForm = $this->createMock(LoginForm::class);
61-
$request = $this->createMock(ServerRequestInterface::class);
55+
$router = $this->createStub(RouterInterface::class);
56+
$template = $this->createStub(TemplateRendererInterface::class);
57+
$authenticationService = $this->createStub(AuthenticationServiceInterface::class);
58+
$messenger = $this->createStub(FlashMessengerInterface::class);
59+
$formsPlugin = $this->createStub(FormsPlugin::class);
60+
$loginForm = $this->createStub(LoginForm::class);
61+
$request = $this->createStub(ServerRequestInterface::class);
6262

6363
$authenticationService->method('hasIdentity')->willReturn(false);
6464

test/Unit/Admin/Handler/Account/GetAccountLogoutHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class GetAccountLogoutHandlerTest extends UnitTest
1919
*/
2020
public function testLogoutWillReturnRedirectResponse(): void
2121
{
22-
$router = $this->createMock(RouterInterface::class);
23-
$authenticationService = $this->createMock(AuthenticationServiceInterface::class);
24-
$request = $this->createMock(ServerRequestInterface::class);
22+
$router = $this->createStub(RouterInterface::class);
23+
$authenticationService = $this->createStub(AuthenticationServiceInterface::class);
24+
$request = $this->createStub(ServerRequestInterface::class);
2525

2626
$handler = new GetLogoutAccountHandler(
2727
$router,

test/Unit/Admin/Handler/Account/PostAccountChangePasswordHandlerTest.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,21 @@
2121
use Mezzio\Template\TemplateRendererInterface;
2222
use PHPUnit\Framework\MockObject\Exception as MockObjectException;
2323
use PHPUnit\Framework\MockObject\MockObject;
24+
use PHPUnit\Framework\MockObject\Stub;
2425
use Psr\Http\Message\ServerRequestInterface;
2526

2627
class PostAccountChangePasswordHandlerTest extends UnitTest
2728
{
28-
private MockObject&AdminServiceInterface $adminService;
29-
private MockObject&RouterInterface $router;
30-
private MockObject&TemplateRendererInterface $template;
31-
private MockObject&AuthenticationServiceInterface $authenticationService;
29+
private Stub&AdminServiceInterface $adminService;
30+
private Stub&RouterInterface $router;
31+
private Stub&TemplateRendererInterface $template;
32+
private Stub&AuthenticationServiceInterface $authenticationService;
3233
private MockObject&FlashMessengerInterface $messenger;
33-
private MockObject&AccountForm $accountForm;
34-
private MockObject&ChangePasswordForm $changePasswordForm;
35-
private MockObject&ServerRequestInterface $request;
36-
private MockObject&AdminIdentity $identity;
37-
private MockObject&Admin $admin;
34+
private Stub&AccountForm $accountForm;
35+
private Stub&ChangePasswordForm $changePasswordForm;
36+
private Stub&ServerRequestInterface $request;
37+
private Stub&AdminIdentity $identity;
38+
private Stub&Admin $admin;
3839
private Logger $logger;
3940

4041
/**
@@ -44,16 +45,16 @@ public function setUp(): void
4445
{
4546
parent::setUp();
4647

47-
$this->adminService = $this->createMock(AdminServiceInterface::class);
48-
$this->router = $this->createMock(RouterInterface::class);
49-
$this->template = $this->createMock(TemplateRendererInterface::class);
50-
$this->authenticationService = $this->createMock(AuthenticationServiceInterface::class);
48+
$this->adminService = $this->createStub(AdminServiceInterface::class);
49+
$this->router = $this->createStub(RouterInterface::class);
50+
$this->template = $this->createStub(TemplateRendererInterface::class);
51+
$this->authenticationService = $this->createStub(AuthenticationServiceInterface::class);
5152
$this->messenger = $this->createMock(FlashMessengerInterface::class);
52-
$this->accountForm = $this->createMock(AccountForm::class);
53-
$this->changePasswordForm = $this->createMock(ChangePasswordForm::class);
54-
$this->request = $this->createMock(ServerRequestInterface::class);
55-
$this->identity = $this->createMock(AdminIdentity::class);
56-
$this->admin = $this->createMock(Admin::class);
53+
$this->accountForm = $this->createStub(AccountForm::class);
54+
$this->changePasswordForm = $this->createStub(ChangePasswordForm::class);
55+
$this->request = $this->createStub(ServerRequestInterface::class);
56+
$this->identity = $this->createStub(AdminIdentity::class);
57+
$this->admin = $this->createStub(Admin::class);
5758
$this->logger = new Logger([
5859
'writers' => [
5960
'FileWriter' => [
@@ -75,6 +76,7 @@ public function testInvalidChangePasswordFormDataProvidedWillReturnHtmlResponse(
7576
$this->changePasswordForm->method('isValid')->willReturn(false);
7677
$this->accountForm->method('prepare')->willReturn('<form></form>');
7778
$this->changePasswordForm->method('prepare')->willReturn('<form></form>');
79+
$this->messenger->expects($this->never())->method('addError');
7880

7981
$handler = new PostChangeAccountPasswordHandler(
8082
$this->adminService,

test/Unit/Admin/Handler/Account/PostAccountEditHandlerTest.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,23 @@
2222
use Mezzio\Template\TemplateRendererInterface;
2323
use PHPUnit\Framework\MockObject\Exception as MockObjectException;
2424
use PHPUnit\Framework\MockObject\MockObject;
25+
use PHPUnit\Framework\MockObject\Stub;
2526
use Psr\Http\Message\ServerRequestInterface;
2627

2728
class PostAccountEditHandlerTest extends UnitTest
2829
{
29-
private MockObject&AdminServiceInterface $adminService;
30-
private MockObject&RouterInterface $router;
31-
private MockObject&TemplateRendererInterface $template;
32-
private MockObject&AuthenticationServiceInterface $authenticationService;
33-
private MockObject&AccountForm $accountForm;
34-
private MockObject&ChangePasswordForm $changePasswordForm;
30+
private Stub&AdminServiceInterface $adminService;
31+
private Stub&RouterInterface $router;
32+
private Stub&TemplateRendererInterface $template;
33+
private Stub&AuthenticationServiceInterface $authenticationService;
34+
private Stub&AccountForm $accountForm;
35+
private Stub&ChangePasswordForm $changePasswordForm;
3536
private MockObject&FlashMessengerInterface $messenger;
3637
private Logger $logger;
37-
private MockObject&AdminIdentity $identity;
38-
private MockObject&ServerRequestInterface $request;
38+
private Stub&AdminIdentity $identity;
39+
private Stub&ServerRequestInterface $request;
3940

40-
private MockObject&Admin $admin;
41+
private Stub&Admin $admin;
4142

4243
/**
4344
* @throws MockObjectException
@@ -46,16 +47,16 @@ public function setUp(): void
4647
{
4748
parent::setUp();
4849

49-
$this->adminService = $this->createMock(AdminServiceInterface::class);
50-
$this->router = $this->createMock(RouterInterface::class);
51-
$this->template = $this->createMock(TemplateRendererInterface::class);
52-
$this->authenticationService = $this->createMock(AuthenticationServiceInterface::class);
53-
$this->accountForm = $this->createMock(AccountForm::class);
54-
$this->changePasswordForm = $this->createMock(ChangePasswordForm::class);
50+
$this->adminService = $this->createStub(AdminServiceInterface::class);
51+
$this->router = $this->createStub(RouterInterface::class);
52+
$this->template = $this->createStub(TemplateRendererInterface::class);
53+
$this->authenticationService = $this->createStub(AuthenticationServiceInterface::class);
54+
$this->accountForm = $this->createStub(AccountForm::class);
55+
$this->changePasswordForm = $this->createStub(ChangePasswordForm::class);
5556
$this->messenger = $this->createMock(FlashMessengerInterface::class);
56-
$this->identity = $this->createMock(AdminIdentity::class);
57-
$this->request = $this->createMock(ServerRequestInterface::class);
58-
$this->admin = $this->createMock(Admin::class);
57+
$this->identity = $this->createStub(AdminIdentity::class);
58+
$this->request = $this->createStub(ServerRequestInterface::class);
59+
$this->admin = $this->createStub(Admin::class);
5960
$this->logger = new Logger([
6061
'writers' => [
6162
'FileWriter' => [
@@ -71,6 +72,7 @@ public function testInvalidAccountFormDataProvidedWillReturnHtmlResponse(): void
7172
$this->request->method('getParsedBody')->willReturn(['test']);
7273
$this->authenticationService->method('getIdentity')->willReturn($this->identity);
7374
$this->accountForm->method('isValid')->willReturn(false);
75+
$this->messenger->expects($this->never())->method('addError');
7476

7577
$handler = new PostEditAccountHandler(
7678
$this->adminService,

0 commit comments

Comments
 (0)