-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Support asserting against chained batches (#49003)
* support asserting against chained batches * work on chained batch truth tests * work on chained batch truth tests * more work on chained batch truth tests * continue working on chained batch truth tests * Apply fixes from StyleCI * attempting to unify chained batch testing * simplify code * add another test * simplify code --------- Co-authored-by: StyleCI Bot <[email protected]>
- Loading branch information
1 parent
e72327a
commit e275b87
Showing
4 changed files
with
143 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Illuminate/Support/Testing/Fakes/ChainedBatchTruthTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Illuminate\Support\Testing\Fakes; | ||
|
||
use Closure; | ||
|
||
class ChainedBatchTruthTest | ||
{ | ||
/** | ||
* The underlying truth test. | ||
* | ||
* @var \Closure | ||
*/ | ||
protected $callback; | ||
|
||
/** | ||
* Create a new truth test instance. | ||
* | ||
* @param \Closure $callback | ||
* @return void | ||
*/ | ||
public function __construct(Closure $callback) | ||
{ | ||
$this->callback = $callback; | ||
} | ||
|
||
/** | ||
* Invoke the truth test with the given pending batch. | ||
* | ||
* @param \Illuminate\Bus\PendingBatch | ||
* @return bool | ||
*/ | ||
public function __invoke($pendingBatch) | ||
{ | ||
return call_user_func($this->callback, $pendingBatch); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters