Fixed tests to account for issue fixed by #1097

This commit is contained in:
James Cole 2018-01-06 07:33:30 +01:00
parent ed0e14aee5
commit 7fa937e80b
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
18 changed files with 66 additions and 53 deletions

View File

@ -53,8 +53,9 @@ class AssetAccountIbans implements MapperInterface
$list[$accountId] = $account->name;
}
}
$list = array_merge($topList, $list);
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
$list = $topList + $list;
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -51,7 +51,8 @@ class AssetAccounts implements MapperInterface
}
$list[$accountId] = $name;
}
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -45,7 +45,8 @@ class Bills implements MapperInterface
$billId = intval($bill->id);
$list[$billId] = $bill->name . ' [' . $bill->match . ']';
}
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -45,7 +45,8 @@ class Budgets implements MapperInterface
$budgetId = intval($budget->id);
$list[$budgetId] = $budget->name;
}
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -45,7 +45,8 @@ class Categories implements MapperInterface
$categoryId = intval($category->id);
$list[$categoryId] = $category->name;
}
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -59,8 +59,9 @@ class OpposingAccountIbans implements MapperInterface
$list[$accountId] = $account->name;
}
}
$list = array_merge($topList, $list);
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
$list = $topList + $list;
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -57,7 +57,8 @@ class OpposingAccounts implements MapperInterface
}
$list[$accountId] = $name;
}
$list = ["0" => trans('import.map_do_not_map')] + $list;
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -45,7 +45,8 @@ class Tags implements MapperInterface
$tagId = intval($tag->id);
$list[$tagId] = $tag->tag;
}
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -42,8 +42,9 @@ class TransactionCurrencies implements MapperInterface
$currencyId = intval($currency->id);
$list[$currencyId] = $currency->name . ' (' . $currency->code . ')';
}
asort($list);
$list = array_merge([0 => trans('import.map_do_not_map')], $list);
$list = [0 => trans('import.map_do_not_map')] + $list;
return $list;
}

View File

@ -41,11 +41,11 @@ class AssetAccountIbansTest extends TestCase
public function testGetMapBasic()
{
$one = new Account;
$one->id = 1;
$one->id = 17;
$one->name = 'Something';
$one->iban = 'IBAN';
$two = new Account;
$two->id = 2;
$two->id = 53;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -58,8 +58,8 @@ class AssetAccountIbansTest extends TestCase
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'IBAN (Something)',
2 => 'Else',
53 => 'Else',
17 => 'IBAN (Something)',
];
$this->assertEquals($result, $mapping);
}

View File

@ -41,11 +41,11 @@ class AssetAccountsTest extends TestCase
public function testGetMapBasic()
{
$one = new Account;
$one->id = 1;
$one->id = 23;
$one->name = 'Something';
$one->iban = 'IBAN';
$two = new Account;
$two->id = 2;
$two->id = 19;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -57,9 +57,10 @@ class AssetAccountsTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something (IBAN)',
2 => 'Else',
0 => strval(trans('import.map_do_not_map')),
19 => 'Else',
23 => 'Something (IBAN)',
];
$this->assertEquals($result, $mapping);
}

View File

@ -41,11 +41,11 @@ class BillsTest extends TestCase
public function testGetMapBasic()
{
$one = new Bill();
$one->id = 1;
$one->id = 5;
$one->name = 'Something';
$one->match = 'hi,bye';
$two = new Account;
$two->id = 2;
$two->id = 9;
$two->name = 'Else';
$two->match = 'match';
$collection = new Collection([$one, $two]);
@ -59,8 +59,8 @@ class BillsTest extends TestCase
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something [hi,bye]',
2 => 'Else [match]',
9 => 'Else [match]',
5 => 'Something [hi,bye]',
];
$this->assertEquals($result, $mapping);
}

View File

@ -40,10 +40,10 @@ class BudgetsTest extends TestCase
public function testGetMapBasic()
{
$one = new Budget;
$one->id = 1;
$one->id = 8;
$one->name = 'Something';
$two = new Budget;
$two->id = 2;
$two->id = 4;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -56,8 +56,9 @@ class BudgetsTest extends TestCase
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something',
2 => 'Else',
4 => 'Else',
8 => 'Something',
];
$this->assertEquals($result, $mapping);
}

View File

@ -40,10 +40,10 @@ class CategoriesTest extends TestCase
public function testGetMapBasic()
{
$one = new Category;
$one->id = 1;
$one->id = 9;
$one->name = 'Something';
$two = new Category;
$two->id = 2;
$two->id = 17;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -55,9 +55,10 @@ class CategoriesTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something',
2 => 'Else',
0 => strval(trans('import.map_do_not_map')),
17 => 'Else',
9 => 'Something',
];
$this->assertEquals($result, $mapping);
}

View File

@ -41,11 +41,11 @@ class OpposingAccountIbansTest extends TestCase
public function testGetMapBasic()
{
$one = new Account;
$one->id = 1;
$one->id = 21;
$one->name = 'Something';
$one->iban = 'IBAN';
$two = new Account;
$two->id = 2;
$two->id = 17;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -59,9 +59,9 @@ class OpposingAccountIbansTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'IBAN (Something)',
2 => 'Else',
0 => strval(trans('import.map_do_not_map')),
17 => 'Else',
21 => 'IBAN (Something)',
];
$this->assertEquals($result, $mapping);
}

View File

@ -41,11 +41,11 @@ class OpposingAccountsTest extends TestCase
public function testGetMapBasic()
{
$one = new Account;
$one->id = 1;
$one->id = 13;
$one->name = 'Something';
$one->iban = 'IBAN';
$two = new Account;
$two->id = 2;
$two->id = 9;
$two->name = 'Else';
$collection = new Collection([$one, $two]);
@ -59,9 +59,9 @@ class OpposingAccountsTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something (IBAN)',
2 => 'Else',
0 => strval(trans('import.map_do_not_map')),
9 => 'Else',
13 => 'Something (IBAN)',
];
$this->assertEquals($result, $mapping);
}

View File

@ -40,10 +40,10 @@ class TagsTest extends TestCase
public function testGetMapBasic()
{
$one = new Tag;
$one->id = 1;
$one->id = 12;
$one->tag = 'Something';
$two = new Tag;
$two->id = 2;
$two->id = 14;
$two->tag = 'Else';
$collection = new Collection([$one, $two]);
@ -55,9 +55,9 @@ class TagsTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something',
2 => 'Else',
0 => strval(trans('import.map_do_not_map')),
14 => 'Else',
12 => 'Something',
];
$this->assertEquals($result, $mapping);
}

View File

@ -40,11 +40,11 @@ class TransactionCurrenciesTest extends TestCase
public function testGetMapBasic()
{
$one = new TransactionCurrency;
$one->id = 1;
$one->id = 9;
$one->name = 'Something';
$one->code = 'ABC';
$two = new TransactionCurrency;
$two->id = 2;
$two->id = 11;
$two->name = 'Else';
$two->code = 'DEF';
$collection = new Collection([$one, $two]);
@ -57,9 +57,10 @@ class TransactionCurrenciesTest extends TestCase
$this->assertCount(3, $mapping);
// assert this is what the result looks like:
$result = [
0 => strval(trans('import.map_do_not_map')),
1 => 'Something (ABC)',
2 => 'Else (DEF)',
0 => strval(trans('import.map_do_not_map')),
11 => 'Else (DEF)',
9 => 'Something (ABC)',
];
$this->assertEquals($result, $mapping);
}