Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Jobs/UserVerifyTest.php
Show All 10 Lines | |||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
User::where('email', 'new-job-user@' . \config('app.domain'))->delete(); | $this->deleteTestUser('new-job-user@' . \config('app.domain')); | ||||
} | |||||
public function tearDown(): void | |||||
{ | |||||
$this->deleteTestUser('new-job-user@' . \config('app.domain')); | |||||
parent::tearDown(); | |||||
} | } | ||||
/** | /** | ||||
* Test job handle | * Test job handle | ||||
*/ | */ | ||||
public function testHandle(): void | public function testHandle(): void | ||||
{ | { | ||||
$user = $this->getTestUser('new-job-user@' . \config('app.domain')); | $user = $this->getTestUser('new-job-user@' . \config('app.domain')); | ||||
$this->assertFalse($user->isImapReady()); | $this->assertFalse($user->isImapReady()); | ||||
$mock = \Mockery::mock('alias:App\Backends\IMAP'); | |||||
$mock->shouldReceive('verifyAccount') | |||||
->once() | |||||
->with($user->email) | |||||
->andReturn(false); | |||||
$job = new UserVerify($user); | $job = new UserVerify($user); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertTrue($user->fresh()->isImapReady() === false); | $this->assertTrue($user->fresh()->isImapReady() === false); | ||||
$mock->shouldReceive('verifyAccount') | |||||
->once() | |||||
->with($user->email) | |||||
->andReturn(true); | |||||
$job->handle(); | |||||
$this->assertTrue($user->fresh()->isImapReady()); | |||||
} | } | ||||
machniak: The test was testing failure and success case. After mocks removal I expect this assertion to… | |||||
} | } |
The test was testing failure and success case. After mocks removal I expect this assertion to fail. The expected result should be that isImapReady() is true. As I mention in another comment this test file is disabled in phpunit.xml.