Skip to content

Commit

Permalink
assertNotDeleted, assertNotFailed, and assertNotReleased
Browse files Browse the repository at this point in the history
  • Loading branch information
gdebrauwer committed Jul 30, 2024
1 parent 7348ac1 commit 493ceb9
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Illuminate/Queue/InteractsWithQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ public function assertDeleted()
return $this;
}

/**
* Assert that the job was not deleted from the queue.
*
* @return $this
*/
public function assertNotDeleted()
{
$this->ensureQueueInteractionsHaveBeenFaked();

PHPUnit::assertTrue(
! $this->job->isDeleted(),
'Job was expected to be not deleted, but was.'
);

return $this;
}

/**
* Assert that the job was manually failed.
*
Expand All @@ -128,6 +145,23 @@ public function assertFailed()
return $this;
}

/**
* Assert that the job was not manually failed.
*
* @return $this
*/
public function assertNotFailed()
{
$this->ensureQueueInteractionsHaveBeenFaked();

PHPUnit::assertTrue(
! $this->job->hasFailed(),
'Job was expected to be not manually failed, but was.'
);

return $this;
}

/**
* Assert that the job was released back onto the queue.
*
Expand Down Expand Up @@ -158,6 +192,23 @@ public function assertReleased($delay = null)
return $this;
}

/**
* Assert that the job was not released back onto the queue.
*
* @return $this
*/
public function assertNotReleased()
{
$this->ensureQueueInteractionsHaveBeenFaked();

PHPUnit::assertTrue(
! $this->job->isReleased(),
'Job was expected to not be released, but was.'
);

return $this;
}

/**
* Ensure that queue interactions have been faked.
*
Expand Down

0 comments on commit 493ceb9

Please sign in to comment.