Improve test coverage.

This commit is contained in:
James Cole
2019-07-31 16:53:09 +02:00
parent 5524941c90
commit 9b574ce7ad
155 changed files with 1890 additions and 2263 deletions

View File

@@ -60,7 +60,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'caha' . random_int(1, 10000);
$job->key = 'caha' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -91,7 +91,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahb' . random_int(1, 10000);
$job->key = 'cahb' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -124,7 +124,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahc' . random_int(1, 10000);
$job->key = 'cahc' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -179,7 +179,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahd' . random_int(1, 10000);
$job->key = 'cahd' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -234,7 +234,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahe' . random_int(1, 10000);
$job->key = 'cahe' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -289,7 +289,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahf' . random_int(1, 10000);
$job->key = 'cahf' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -335,7 +335,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahg' . random_int(1, 10000);
$job->key = 'cahg' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -398,7 +398,7 @@ class ChooseAccountsHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cahg' . random_int(1, 10000);
$job->key = 'cahg' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';

View File

@@ -51,7 +51,7 @@ class NewBunqJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'cXha' . random_int(1, 10000);
$job->key = 'cXha' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';

View File

@@ -63,7 +63,7 @@ class ConfigureMappingHandlerTest extends TestCase
$importRepos->shouldReceive('setUser')->once();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapG' . random_int(1, 10000);
$job->key = 'mapG' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -131,7 +131,7 @@ class ConfigureMappingHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapA' . random_int(1, 10000);
$job->key = 'mapA' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -165,7 +165,7 @@ class ConfigureMappingHandlerTest extends TestCase
$importRepos->shouldReceive('setUser')->once();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapE' . random_int(1, 10000);
$job->key = 'mapE' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -230,7 +230,7 @@ class ConfigureMappingHandlerTest extends TestCase
$importRepos->shouldReceive('setUser')->once();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapC' . random_int(1, 10000);
$job->key = 'mapC' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -260,7 +260,7 @@ class ConfigureMappingHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapH' . random_int(1, 10000);
$job->key = 'mapH' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -343,7 +343,7 @@ class ConfigureMappingHandlerTest extends TestCase
$importRepos->shouldReceive('setUser')->once();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapD' . random_int(1, 10000);
$job->key = 'mapD' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -372,7 +372,7 @@ class ConfigureMappingHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapF' . random_int(1, 10000);
$job->key = 'mapF' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -461,7 +461,7 @@ class ConfigureMappingHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapB' . random_int(1, 10000);
$job->key = 'mapB' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -491,7 +491,7 @@ class ConfigureMappingHandlerTest extends TestCase
$importRepos->shouldReceive('setUser')->once();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'mapB' . random_int(1, 10000);
$job->key = 'mapB' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -134,7 +134,7 @@ class ConfigureRolesHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'role-B' . random_int(1, 10000);
$job->key = 'role-B' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -215,7 +215,7 @@ class ConfigureRolesHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'role-x' . random_int(1, 10000);
$job->key = 'role-x' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -297,7 +297,7 @@ class ConfigureRolesHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'role-x' . random_int(1, 10000);
$job->key = 'role-x' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -368,7 +368,7 @@ class ConfigureRolesHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'role-x' . random_int(1, 10000);
$job->key = 'role-x' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -543,7 +543,7 @@ class ConfigureRolesHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'role-A' . random_int(1, 10000);
$job->key = 'role-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -53,7 +53,7 @@ class ConfigureUploadHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'upload-B' . random_int(1, 10000);
$job->key = 'upload-B' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -102,7 +102,7 @@ class ConfigureUploadHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'upload-B' . random_int(1, 10000);
$job->key = 'upload-B' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -150,7 +150,7 @@ class ConfigureUploadHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'upload-A' . random_int(1, 10000);
$job->key = 'upload-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -56,7 +56,7 @@ class NewFileJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'newfile-A' . random_int(1, 10000);
$job->key = 'newfile-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -111,7 +111,7 @@ class NewFileJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'newfile-A' . random_int(1, 10000);
$job->key = 'newfile-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -169,7 +169,7 @@ class NewFileJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'newfile-A' . random_int(1, 10000);
$job->key = 'newfile-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -216,7 +216,7 @@ class NewFileJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'newfile-x' . random_int(1, 10000);
$job->key = 'newfile-x' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';
@@ -264,7 +264,7 @@ class NewFileJobHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'newfile-x' . random_int(1, 10000);
$job->key = 'newfile-x' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -64,7 +64,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-A' . random_int(1, 10000);
$job->key = 'sca-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -99,7 +99,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-B' . random_int(1, 10000);
$job->key = 'sca-B' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -138,7 +138,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-c' . random_int(1, 10000);
$job->key = 'sca-c' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -197,7 +197,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-E' . random_int(1, 10000);
$job->key = 'sca-E' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -256,7 +256,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-D' . random_int(1, 10000);
$job->key = 'sca-D' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -313,7 +313,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-E' . random_int(1, 10000);
$job->key = 'sca-E' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -443,7 +443,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-F' . random_int(1, 10000);
$job->key = 'sca-F' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -596,7 +596,7 @@ class ChooseAccountsHandlerTest extends TestCase
// fake job:
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sca-F' . random_int(1, 10000);
$job->key = 'sca-F' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';

View File

@@ -62,7 +62,7 @@ class ChooseLoginHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'slh-A' . random_int(1, 10000);
$job->key = 'slh-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -85,7 +85,7 @@ class ChooseLoginHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'slh-B' . random_int(1, 10000);
$job->key = 'slh-B' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -109,7 +109,7 @@ class ChooseLoginHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'slh-C' . random_int(1, 10000);
$job->key = 'slh-C' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -149,7 +149,7 @@ class ChooseLoginHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'slh-C' . random_int(1, 10000);
$job->key = 'slh-C' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -269,7 +269,7 @@ class ChooseLoginHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'slh-C' . random_int(1, 10000);
$job->key = 'slh-C' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';

View File

@@ -62,7 +62,7 @@ class DoAuthenticateHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sda-A' . random_int(1, 10000);
$job->key = 'sda-A' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';

View File

@@ -67,7 +67,7 @@ class StageImportDataHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sidh_bbunq_' . random_int(1, 10000);
$job->key = 'sidh_bbunq_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -117,7 +117,7 @@ class StageImportDataHandlerTest extends TestCase
$payment = new BunqPayment($amount, $pointer, 'Some descr', null, null);
$payment->setAmount($amount);
$payment->setCounterpartyAlias($labelMonetaryAccount);
$payment->setDescription('Random description #' . random_int(1, 10000));
$payment->setDescription('Random description #' . $this->randomInt());
$value = [$payment];
$list = new BunqResponsePaymentList($value, [], null);
@@ -216,7 +216,7 @@ class StageImportDataHandlerTest extends TestCase
// {
// $job = new ImportJob;
// $job->user_id = $this->user()->id;
// $job->key = 'sidA_bbunq_' . random_int(1, 10000);
// $job->key = 'sidA_bbunq_' . $this->randomInt();
// $job->status = 'new';
// $job->stage = 'new';
// $job->provider = 'bunq';
@@ -290,7 +290,7 @@ class StageImportDataHandlerTest extends TestCase
// {
// $job = new ImportJob;
// $job->user_id = $this->user()->id;
// $job->key = 'sidh_bbunq_' . random_int(1, 10000);
// $job->key = 'sidh_bbunq_' . $this->randomInt();
// $job->status = 'new';
// $job->stage = 'new';
// $job->provider = 'bunq';
@@ -344,7 +344,7 @@ class StageImportDataHandlerTest extends TestCase
//
// $payment = new BunqPayment($amount, $pointer, 'Some descr', null, null);
// $payment->setAmount($amount);
// $payment->setDescription('Some random thing #' . random_int(1, 10000));
// $payment->setDescription('Some random thing #' . $this->randomInt());
// $payment->setCounterpartyAlias($labelMonetaryAccount);
// $value = [$payment];
// $list = new BunqResponsePaymentList($value, [], null);
@@ -427,7 +427,7 @@ class StageImportDataHandlerTest extends TestCase
// {
// $job = new ImportJob;
// $job->user_id = $this->user()->id;
// $job->key = 'sidh_bbunq_' . random_int(1, 10000);
// $job->key = 'sidh_bbunq_' . $this->randomInt();
// $job->status = 'new';
// $job->stage = 'new';
// $job->provider = 'bunq';
@@ -477,7 +477,7 @@ class StageImportDataHandlerTest extends TestCase
// $payment = new BunqPayment($amount, $pointer, 'Some descr', null, null);
// $payment->setAmount($amount);
// $payment->setCounterpartyAlias($labelMonetaryAccount);
// $payment->setDescription('Random transfer #' . random_int(1, 10000));
// $payment->setDescription('Random transfer #' . $this->randomInt());
// $value = [$payment];
// $list = new BunqResponsePaymentList($value, [], null);
//

View File

@@ -67,7 +67,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'snh_bunq_' . random_int(1, 10000);
$job->key = 'snh_bunq_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -154,7 +154,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'snha_bunq_' . random_int(1, 10000);
$job->key = 'snha_bunq_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';
@@ -246,7 +246,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'snh_bbunq_' . random_int(1, 10000);
$job->key = 'snh_bbunq_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'bunq';

View File

@@ -87,8 +87,8 @@ class ImportableConverterTest extends TestCase
$accountRepos->shouldReceive('setUser')->once();
// get default currency
$euro = TransactionCurrency::whereCode('EUR')->first();
$usd = TransactionCurrency::whereCode('USD')->first();
$euro = $this->getEuro();
$usd = $this->getDollar();
Amount::shouldReceive('getDefaultCurrencyByUser')->andReturn($euro)->once();
// set user and config:
@@ -113,9 +113,9 @@ class ImportableConverterTest extends TestCase
$result = $converter->convert($importables);
// verify content of $result
$this->assertEquals('withdrawal', $result[0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['date']);
$this->assertEquals($importable->tags, $result[0]['tags']);
$this->assertEquals('withdrawal', $result[0]['transactions'][0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['transactions'][0]['date']);
$this->assertEquals($importable->tags, $result[0]['transactions'][0]['tags']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
}
@@ -176,9 +176,9 @@ class ImportableConverterTest extends TestCase
// verify content of $result
$today = new Carbon();
$this->assertEquals('transfer', $result[0]['type']);
$this->assertEquals($today->format('Y-m-d H:i:s'), $result[0]['date']);
$this->assertEquals([], $result[0]['tags']);
$this->assertEquals('transfer', $result[0]['transactions'][0]['type']);
$this->assertEquals($today->format('Y-m-d H:i:s'), $result[0]['transactions'][0]['date']);
$this->assertEquals([], $result[0]['transactions'][0]['tags']);
$this->assertEquals($euro->id, $result[0]['transactions'][0]['currency_id']);
}
@@ -237,13 +237,13 @@ class ImportableConverterTest extends TestCase
$result = $converter->convert($importables);
// verify content of $result
$this->assertEquals('deposit', $result[0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['date']);
$this->assertEquals([], $result[0]['tags']);
$this->assertEquals('deposit', $result[0]['transactions'][0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['transactions'][0]['date']);
$this->assertEquals([], $result[0]['transactions'][0]['tags']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
$this->assertEquals($revenue->id, $result[0]['transactions'][0]['source_id']);
$this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']);
$this->assertEquals('2018-01-02 00:00:00', $result[0]['book_date']);
$this->assertEquals('2018-01-02 00:00:00', $result[0]['transactions'][0]['book_date']);
}
@@ -361,11 +361,11 @@ class ImportableConverterTest extends TestCase
$result = $converter->convert($importables);
// verify content of $result
$this->assertEquals('transfer', $result[0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['date']);
$this->assertEquals([], $result[0]['tags']);
$this->assertEquals(2, $result[0]['bill_id']); // will NOT be ignored.
$this->assertEquals($importable->billName, $result[0]['bill_name']);
$this->assertEquals('transfer', $result[0]['transactions'][0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['transactions'][0]['date']);
$this->assertEquals([], $result[0]['transactions'][0]['tags']);
$this->assertEquals(2, $result[0]['transactions'][0]['bill_id']); // will NOT be ignored.
$this->assertEquals($importable->billName, $result[0]['transactions'][0]['bill_name']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
// since amount is positive, $asset recieves the money
@@ -434,11 +434,11 @@ class ImportableConverterTest extends TestCase
$result = $converter->convert($importables);
// verify content of $result
$this->assertEquals('transfer', $result[0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['date']);
$this->assertEquals([], $result[0]['tags']);
$this->assertEquals(3, $result[0]['bill_id']);
$this->assertEquals($importable->billName, $result[0]['bill_name']);
$this->assertEquals('transfer', $result[0]['transactions'][0]['type']);
$this->assertEquals('2018-09-17 00:00:00', $result[0]['transactions'][0]['date']);
$this->assertEquals([], $result[0]['transactions'][0]['tags']);
$this->assertEquals(3, $result[0]['transactions'][0]['bill_id']);
$this->assertEquals($importable->billName, $result[0]['transactions'][0]['bill_name']);
$this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']);
// since amount is negative, $asset sends the money

View File

@@ -55,7 +55,7 @@ class LineReaderTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'linerA' . random_int(1, 10000);
$job->key = 'linerA' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -132,7 +132,7 @@ class MappingConvergerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'linerB' . random_int(1, 10000);
$job->key = 'linerB' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'fake';

View File

@@ -72,16 +72,16 @@ class OpposingAccountMapperTest extends TestCase
*/
public function testAccountIdBadType(): void
{
$expected = $this->user()->accounts()->where('account_type_id', 5)->inRandomOrder()->first();
$expected = $this->getRandomRevenue();
$expected->iban = null;
$expected->save();
$amount = '-12.34';
$expectedArgs = [
'name' => $expected->name,
'iban' => null,
'accountNumber' => null,
'account_number' => null,
'account_type_id' => null,
'accountType' => AccountType::EXPENSE,
'account_type' => AccountType::EXPENSE,
'active' => true,
'BIC' => null,
];
@@ -116,9 +116,9 @@ class OpposingAccountMapperTest extends TestCase
$expectedArgs = [
'name' => $expected->name,
'iban' => $expected->iban,
'accountNumber' => null,
'account_number' => null,
'account_type_id' => null,
'accountType' => AccountType::EXPENSE,
'account_type' => AccountType::EXPENSE,
'active' => true,
'BIC' => null,
];
@@ -152,9 +152,9 @@ class OpposingAccountMapperTest extends TestCase
$expectedArgs = [
'name' => '(no name)',
'iban' => null,
'accountNumber' => null,
'account_number' => null,
'account_type_id' => null,
'accountType' => AccountType::EXPENSE,
'account_type' => AccountType::EXPENSE,
'active' => true,
'BIC' => null,
];
@@ -184,9 +184,9 @@ class OpposingAccountMapperTest extends TestCase
$expectedArgs = [
'name' => '(no name)',
'iban' => null,
'accountNumber' => null,
'account_number' => null,
'account_type_id' => null,
'accountType' => AccountType::REVENUE,
'account_type' => AccountType::REVENUE,
'active' => true,
'BIC' => null,
];

View File

@@ -122,7 +122,7 @@ class StageAuthenticatedHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sa_a_' . random_int(1, 10000);
$job->key = 'sa_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -251,7 +251,7 @@ class StageAuthenticatedHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sa_a_' . random_int(1, 10000);
$job->key = 'sa_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -380,7 +380,7 @@ class StageAuthenticatedHandlerTest extends TestCase
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sa_a_' . random_int(1, 10000);
$job->key = 'sa_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';

View File

@@ -325,7 +325,7 @@ class StageImportDataHandlerTest extends TestCase
$revenue = $this->user()->accounts()->where('account_type_id', 5)->first();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sid_a_' . random_int(1, 10000);
$job->key = 'sid_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -524,7 +524,7 @@ class StageImportDataHandlerTest extends TestCase
$revenue = $this->user()->accounts()->where('account_type_id', 5)->first();
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sid_a_' . random_int(1, 10000);
$job->key = 'sid_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';

View File

@@ -67,7 +67,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sn_a_' . random_int(1, 10000);
$job->key = 'sn_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -134,7 +134,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sn_a_' . random_int(1, 10000);
$job->key = 'sn_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -187,7 +187,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sn_a_' . random_int(1, 10000);
$job->key = 'sn_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';
@@ -256,7 +256,7 @@ class StageNewHandlerTest extends TestCase
{
$job = new ImportJob;
$job->user_id = $this->user()->id;
$job->key = 'sn_a_' . random_int(1, 10000);
$job->key = 'sn_a_' . $this->randomInt();
$job->status = 'new';
$job->stage = 'new';
$job->provider = 'spectre';