Follow up #12548
|
$this->createStub(\Horde_Imap_Client_Socket::class), |
The sync() expectation is matching against fresh stubs created inline for the IMAP client and logger. SyncService is very likely to pass the exact instances it uses internally (client from the factory, logger from the constructor), so these should be captured into variables/properties and reused in with(...) (or replaced with looser constraints) to avoid brittle, failing argument matching.
|
->with($this->createStub(\Horde_Imap_Client_Socket::class), $mailbox); |
syncStats() is asserted with a newly created IMAP client stub. This will not be the same instance as the client returned by the factory in this test, so the expectation is likely to fail. Reuse the same $client stub (or use a type/constraint matcher) for both the factory return and the syncStats() expectation.
|
->willReturn($this->createStub(\Horde_Imap_Client_Socket::class)); |
In this test you create a new IMAP client stub inline in the willReturn(...) call, but later the expectations use different stubs for the IMAP client argument. If SyncService::syncMailbox() passes the client returned by IMAPClientFactory::getClient() through, these argument comparisons will not match and the test will fail. Assign the client stub to a variable (or use a constraint like isInstanceOf) and reuse it consistently across all expectations.
Follow up #12548
mail/tests/Unit/Service/Sync/SyncServiceTest.php
Line 105 in 65a26b2
mail/tests/Unit/Service/Sync/SyncServiceTest.php
Line 114 in 65a26b2
mail/tests/Unit/Service/Sync/SyncServiceTest.php
Line 96 in 65a26b2