Some last-minute fixes.

This commit is contained in:
James Cole
2018-07-03 18:24:43 +02:00
parent 18b06ff283
commit d3a1f43cbb
13 changed files with 84 additions and 37 deletions

View File

@@ -225,7 +225,7 @@ class IndexControllerTest extends TestCase
$this->be($this->user());
$response = $this->get(route('import.job.download', [$job->key]));
$response->assertStatus(200);
$response->assertExactJson(['column-mapping-config' => [], 'delimiter' => ',', 'hi' => 'there', 1 => true]);
$response->assertExactJson(['column-mapping-config' => ['a', 'b', 'c'], 'delimiter' => ',', 'hi' => 'there', 1 => true]);
}
/**

View File

@@ -342,8 +342,8 @@ class ImportableConverterTest extends TestCase
$this->assertEquals($importable->billName, $result[0]['bill_name']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
// since amount is positive, $asset recieves the money
$this->assertEquals($other->id, $result[0]['transactions'][0]['source_id']);
$this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']);
$this->assertEquals($asset->id, $result[0]['transactions'][0]['source_id']);
$this->assertEquals($other->id, $result[0]['transactions'][0]['destination_id']);
}
/**
@@ -412,8 +412,8 @@ class ImportableConverterTest extends TestCase
$this->assertEquals($importable->billName, $result[0]['bill_name']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
// since amount is negative, $asset sends the money
$this->assertEquals($asset->id, $result[0]['transactions'][0]['source_id']);
$this->assertEquals($other->id, $result[0]['transactions'][0]['destination_id']);
$this->assertEquals($other->id, $result[0]['transactions'][0]['source_id']);
$this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']);
}
/**

View File

@@ -37,7 +37,14 @@ class HasAnyBudgetTest extends TestCase
*/
public function testTriggered(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$loop = 0;
do {
/** @var TransactionJournal $journal */
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->count();
$loop++;
} while ($count !== 0 && $loop < 30);
$budget = $journal->user->budgets()->first();
$journal->budgets()->detach();
$journal->budgets()->save($budget);
@@ -46,6 +53,7 @@ class HasAnyBudgetTest extends TestCase
$trigger = HasAnyBudget::makeFromStrings('', false);
$result = $trigger->triggered($journal);
$this->assertTrue($result);
}
/**
@@ -53,11 +61,13 @@ class HasAnyBudgetTest extends TestCase
*/
public function testTriggeredNot(): void
{
$loop = 0;
do {
/** @var TransactionJournal $journal */
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->count();
} while ($count !== 0);
$loop++;
} while ($count !== 0 && $loop < 30);
$journal->budgets()->detach();
$this->assertEquals(0, $journal->budgets()->count());
@@ -78,7 +88,14 @@ class HasAnyBudgetTest extends TestCase
*/
public function testTriggeredTransactions(): void
{
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$loop = 0;
do {
/** @var TransactionJournal $journal */
$journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first();
$count = $journal->transactions()->count();
$loop++;
} while ($count !== 0 && $loop < 30);
$budget = $journal->user->budgets()->first();
$journal->budgets()->detach();
$this->assertEquals(0, $journal->budgets()->count());