diff --git a/tests/Api/V1/Controllers/TransactionControllerTest.php b/tests/Api/V1/Controllers/TransactionControllerTest.php index 66f000f704..d196a27654 100644 --- a/tests/Api/V1/Controllers/TransactionControllerTest.php +++ b/tests/Api/V1/Controllers/TransactionControllerTest.php @@ -1362,12 +1362,12 @@ class TransactionControllerTest extends TestCase $response->assertStatus(200); $response->assertJson( [ - 'data' => [ - 'attributes' => [ - 'description' => $journal->description, - 'type' => 'Deposit', - ], - ], + 'data' => [[ + 'attributes' => [ + 'description' => $journal->description, + 'type' => 'Deposit', + ], + ]], ] ); @@ -1423,12 +1423,14 @@ class TransactionControllerTest extends TestCase $response->assertJson( [ 'data' => [ - 'attributes' => [ - 'description' => $journal->description, - ], - 'links' => [ - 0 => [], - 'self' => true, + [ + 'attributes' => [ + 'description' => $journal->description, + ], + 'links' => [ + 0 => [], + 'self' => true, + ], ], ], diff --git a/tests/Unit/TransactionRules/Triggers/HasAnyCategoryTest.php b/tests/Unit/TransactionRules/Triggers/HasAnyCategoryTest.php index e8e38e08e4..79a5969938 100644 --- a/tests/Unit/TransactionRules/Triggers/HasAnyCategoryTest.php +++ b/tests/Unit/TransactionRules/Triggers/HasAnyCategoryTest.php @@ -70,13 +70,11 @@ class HasAnyCategoryTest extends TestCase $journal->categories()->detach(); $this->assertEquals(0, $journal->categories()->count()); - // append to transaction + // append to transaction, not to journal. foreach ($journal->transactions()->get() as $index => $transaction) { - $transaction->categories()->detach(); - if (0 === $index) { - $transaction->categories()->save($category); - } + $transaction->categories()->sync([$category->id]); } + $this->assertEquals(0, $journal->categories()->count()); $trigger = HasAnyCategory::makeFromStrings('', false); $result = $trigger->triggered($journal);