Fix tests.

This commit is contained in:
James Cole
2018-07-01 09:27:22 +02:00
parent 0502f2a4a5
commit db149ca6e1
50 changed files with 551 additions and 647 deletions

View File

@@ -36,7 +36,11 @@ class CategoryIsTest extends TestCase
*/
public function testTriggeredJournal(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$transactions = $journal->transactions()->count();
} while ($transactions === 0);
$category = $journal->user->categories()->first();
$journal->categories()->detach();
$journal->categories()->save($category);
@@ -52,7 +56,11 @@ class CategoryIsTest extends TestCase
*/
public function testTriggeredNotJournal(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$transactions = $journal->transactions()->count();
} while ($transactions === 0);
$category = $journal->user->categories()->first();
$otherCategory = $journal->user->categories()->where('id', '!=', $category->id)->first();
$journal->categories()->detach();
@@ -69,7 +77,11 @@ class CategoryIsTest extends TestCase
*/
public function testTriggeredTransaction(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
do {
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$transactions = $journal->transactions()->count();
} while ($transactions === 0);
$transaction = $journal->transactions()->first();
$category = $journal->user->categories()->first();