Skip to content

Commit 83c128e

Browse files
committed
Use phpunit 13 where possible
1 parent 695fdc7 commit 83c128e

6 files changed

Lines changed: 19 additions & 5612 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ phpunit.xml
66
/.phpunit.cache/
77
/build/
88
/vendor/
9-
!/vendor-bin/tools/composer.lock
109
/vendor-bin/tools/vendor/
1110
/vendor-bin/tools/bin/

tests/Doctrine/BaseUserManagerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ protected function setUp(): void
4545
$this->repository = $this->getMockBuilder(ObjectRepository::class)->getMock();
4646

4747
$this->om
48-
->method('getRepository')
48+
->expects(self::any())->method('getRepository')
4949
->with(self::equalTo(self::USER_CLASS))
5050
->willReturn($this->repository)
5151
;
5252
$this->om
53-
->method('getClassMetadata')
53+
->expects(self::any())->method('getClassMetadata')
5454
->with(self::equalTo(self::USER_CLASS))
5555
->willReturn($class)
5656
;
57+
5758
$class
5859
->method('getName')
5960
->willReturn(self::USER_CLASS)

tests/Mailer/SimpleMailerTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ public function testSendResettingEmail(): void
4848
{
4949
$mailer = $this->getMailer();
5050

51-
$this->translator->method('trans')->with(self::anything(), self::anything(), self::anything())
51+
$this->translator->expects(self::once())->method('trans')
52+
->with(self::anything(), self::anything(), self::anything())
5253
->willReturnArgument(0)
5354
;
5455

55-
$this->generator->method('generate')->with(self::anything(), self::anything(), self::anything())
56+
$this->generator->expects(self::once())->method('generate')
57+
->with(self::anything(), self::anything(), self::anything())
5658
->willReturn('http://something.local')
5759
;
5860

59-
$this->swiftMailer->expects(self::once())->method('send')->with(self::isInstanceOf(TemplatedEmail::class));
61+
$this->swiftMailer->expects(self::once())->method('send')
62+
->with(self::isInstanceOf(TemplatedEmail::class))
63+
;
6064

6165
$mailer->sendResettingEmailMessage($this->getUser());
6266
}

tests/Util/SimpleUserManipulatorTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ public function testCreateWithHasher(): void
8484
$requestStackMock = $this->getRequestStackMock(true);
8585

8686
$hasher = $this->createMock(UserPasswordHasherInterface::class);
87-
$hasher->method('hashPassword')->with($user, $password)->willReturn('hashed_password');
87+
$hasher->expects(self::once())->method('hashPassword')
88+
->with($user, $password)
89+
->willReturn('hashed_password')
90+
;
8891

8992
$manipulator = new SimpleUserManipulator($userManagerMock, $eventDispatcherMock, $requestStackMock, $hasher);
9093
$manipulator->create($username, $password, $email, true, false);
@@ -383,7 +386,10 @@ public function testChangePasswordWithValidUsernameAndHasher(): void
383386
$requestStackMock = $this->getRequestStackMock(true);
384387

385388
$hasher = $this->createMock(UserPasswordHasherInterface::class);
386-
$hasher->method('hashPassword')->with($user, $password)->willReturn('hashed_password');
389+
$hasher->expects(self::once())->method('hashPassword')
390+
->with($user, $password)
391+
->willReturn('hashed_password')
392+
;
387393

388394
$manipulator = new SimpleUserManipulator($userManagerMock, $eventDispatcherMock, $requestStackMock, $hasher);
389395
$manipulator->changePassword($username, $password);

vendor-bin/tools/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"phpstan/phpstan-phpunit": "^2.0.0",
1414
"phpstan/phpstan-strict-rules": "^2.0.0",
1515
"phpstan/phpstan-symfony": "^2.0.0",
16-
"phpunit/phpunit": "^12.0.0",
16+
"phpunit/phpunit": "^12.0.0 || ^13.0.0",
1717
"symfony/phpunit-bridge": "^8.0"
1818
},
1919
"config": {

0 commit comments

Comments
 (0)