diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2025-12-21 22:50:38 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2025-12-21 22:54:38 +0000 |
| commit | 96eac16fc8aab503603e8022a5b3984b7db81491 (patch) | |
| tree | 93c9c9d5885437b820ad62c2a9466b7c01c232e5 /tests/app/Services | |
| parent | 33d40303f04401ae7926f2aaf30d97e4f887e484 (diff) | |
| download | webtrees-96eac16fc8aab503603e8022a5b3984b7db81491.tar.gz webtrees-96eac16fc8aab503603e8022a5b3984b7db81491.tar.bz2 webtrees-96eac16fc8aab503603e8022a5b3984b7db81491.zip | |
PHPunit: mock objects have expectations, stubs do not
Diffstat (limited to 'tests/app/Services')
| -rw-r--r-- | tests/app/Services/EmailServiceTest.php | 8 | ||||
| -rw-r--r-- | tests/app/Services/GedcomEditServiceTest.php | 4 | ||||
| -rw-r--r-- | tests/app/Services/TimeoutServiceTest.php | 14 | ||||
| -rw-r--r-- | tests/app/Services/UserServiceTest.php | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/tests/app/Services/EmailServiceTest.php b/tests/app/Services/EmailServiceTest.php index 0130b60b83..6f2aa37b9f 100644 --- a/tests/app/Services/EmailServiceTest.php +++ b/tests/app/Services/EmailServiceTest.php @@ -36,16 +36,16 @@ class EmailServiceTest extends TestCase { $email_service = new EmailService(); - $user_from = $this->createMock(UserInterface::class); + $user_from = $this->createStub(UserInterface::class); $user_from->method('email')->willReturn('user.from@example.com'); - $user_from = $this->createMock(UserInterface::class); + $user_from = $this->createStub(UserInterface::class); $user_from->method('email')->willReturn('user.from@example.com'); - $user_to = $this->createMock(UserInterface::class); + $user_to = $this->createStub(UserInterface::class); $user_to->method('email')->willReturn('user.to@example.com'); - $user_reply_to = $this->createMock(UserInterface::class); + $user_reply_to = $this->createStub(UserInterface::class); $user_reply_to->method('email')->willReturn('user.replyto@example.com'); Site::setPreference('SMTP_ACTIVE', 'internal'); diff --git a/tests/app/Services/GedcomEditServiceTest.php b/tests/app/Services/GedcomEditServiceTest.php index 4c4956f904..468e5d1181 100644 --- a/tests/app/Services/GedcomEditServiceTest.php +++ b/tests/app/Services/GedcomEditServiceTest.php @@ -116,7 +116,7 @@ class GedcomEditServiceTest extends TestCase { $gedcom_edit_service = new GedcomEditService(); - $tree = $this->createMock(Tree::class); + $tree = $this->createStub(Tree::class); $tree->method('getPreference')->with('QUICK_REQUIRED_FAMFACTS')->willReturn($required_famfacts); $new_facts = $gedcom_edit_service->newFamilyFacts($tree); @@ -141,7 +141,7 @@ class GedcomEditServiceTest extends TestCase ): void { $gedcom_edit_service = new GedcomEditService(); - $tree = $this->createMock(Tree::class); + $tree = $this->createStub(Tree::class); $tree->method('getPreference')->with('QUICK_REQUIRED_FACTS')->willReturn($required_facts); $new_facts = $gedcom_edit_service->newIndividualFacts($tree, $sex, $names); diff --git a/tests/app/Services/TimeoutServiceTest.php b/tests/app/Services/TimeoutServiceTest.php index 44c03f9ba6..621727483a 100644 --- a/tests/app/Services/TimeoutServiceTest.php +++ b/tests/app/Services/TimeoutServiceTest.php @@ -29,7 +29,7 @@ class TimeoutServiceTest extends TestCase { public function testNoTimeOut(): void { - $php_service = $this->createMock(PhpService::class); + $php_service = $this->createStub(PhpService::class); $php_service->method('maxExecutionTime')->willReturn(0); $now = 1500000000.0; @@ -41,14 +41,14 @@ class TimeoutServiceTest extends TestCase public function testTimeOutReached(): void { - $php_service = $this->createMock(PhpService::class); + $php_service = $this->createStub(PhpService::class); $php_service->method('maxExecutionTime')->willReturn(30); $now = 1500000000.0; $timeout_service = new TimeoutService($php_service, $now); - $time_factory = $this->createMock(TimeFactoryInterface::class); + $time_factory = $this->createStub(TimeFactoryInterface::class); $time_factory->method('now')->willReturn($now + 60.0); Registry::timeFactory($time_factory); @@ -57,14 +57,14 @@ class TimeoutServiceTest extends TestCase public function testTimeOutNotReached(): void { - $php_service = $this->createMock(PhpService::class); + $php_service = $this->createStub(PhpService::class); $php_service->method('maxExecutionTime')->willReturn(30); $now = Registry::timeFactory()->now(); $timeout_service = new TimeoutService($php_service, $now); - $time_factory = $this->createMock(TimeFactoryInterface::class); + $time_factory = $this->createStub(TimeFactoryInterface::class); $time_factory->method('now')->willReturn($now + 10.0); Registry::timeFactory($time_factory); @@ -77,7 +77,7 @@ class TimeoutServiceTest extends TestCase $timeout_service = new TimeoutService(new PhpService(), $now); - $time_factory = $this->createMock(TimeFactoryInterface::class); + $time_factory = $this->createStub(TimeFactoryInterface::class); $time_factory->method('now')->willReturn($now + 1.4); Registry::timeFactory($time_factory); @@ -90,7 +90,7 @@ class TimeoutServiceTest extends TestCase $timeout_service = new TimeoutService(new PhpService(), $now); - $time_factory = $this->createMock(TimeFactoryInterface::class); + $time_factory = $this->createStub(TimeFactoryInterface::class); $time_factory->method('now')->willReturn($now + 1.6); Registry::timeFactory($time_factory); diff --git a/tests/app/Services/UserServiceTest.php b/tests/app/Services/UserServiceTest.php index 794ff47303..0e6cb16174 100644 --- a/tests/app/Services/UserServiceTest.php +++ b/tests/app/Services/UserServiceTest.php @@ -34,7 +34,7 @@ class UserServiceTest extends TestCase { parent::setUp(); - $cache_factory = $this->createMock(CacheFactoryInterface::class); + $cache_factory = $this->createStub(CacheFactoryInterface::class); $cache_factory->method('array')->willReturn(new Cache(new NullAdapter())); Registry::cache($cache_factory); } |
