Improve test coverage and quality

This commit is contained in:
James Cole
2019-06-16 13:16:46 +02:00
parent 1ce1a84c9e
commit 72c0d7a874
34 changed files with 3211 additions and 2524 deletions

View File

@@ -101,7 +101,7 @@ class CreateControllerTest extends TestCase
$this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'new account ' . random_int(1000, 9999),
'name' => 'new account ' . $this->randomInt(),
'what' => 'asset',
];
@@ -127,7 +127,7 @@ class CreateControllerTest extends TestCase
$this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'new account ' . random_int(1000, 9999),
'name' => 'new account ' . $this->randomInt(),
'what' => 'asset',
'create_another' => 1,
];
@@ -157,7 +157,7 @@ class CreateControllerTest extends TestCase
$this->session(['accounts.create.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'new liability account ' . random_int(1000, 9999),
'name' => 'new liability account ' . $this->randomInt(),
'what' => 'liabilities',
'liability_type_id' => AccountType::where('type', AccountType::LOAN)->first()->id,
'openingBalance' => '100',

View File

@@ -205,7 +205,7 @@ class EditControllerTest extends TestCase
$this->session(['accounts.edit.uri' => 'http://localhost/javascript/account']);
$this->be($this->user());
$data = [
'name' => 'updated account ' . random_int(1000, 9999),
'name' => 'updated account ' . $this->randomInt(),
'active' => 1,
'what' => 'asset',
];
@@ -232,7 +232,7 @@ class EditControllerTest extends TestCase
$this->session(['accounts.edit.uri' => 'http://localhost']);
$this->be($this->user());
$data = [
'name' => 'updated account ' . random_int(1000, 9999),
'name' => 'updated account ' . $this->randomInt(),
'active' => 1,
'what' => 'asset',
'return_to_edit' => '1',

View File

@@ -190,7 +190,7 @@ class AttachmentControllerTest extends TestCase
$this->session(['attachments.edit.uri' => 'http://localhost']);
$data = [
'title' => 'Some updated title ' . random_int(1000, 9999),
'title' => 'Some updated title ' . $this->randomInt(),
'notes' => 'A',
'description' => 'B',
];

View File

@@ -326,7 +326,7 @@ class BillControllerTest extends TestCase
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
$data = [
'name' => 'New Bill ' . random_int(1000, 9999),
'name' => 'New Bill ' . $this->randomInt(),
'amount_min' => '100',
'transaction_currency_id' => 1,
'skip' => 0,
@@ -364,7 +364,7 @@ class BillControllerTest extends TestCase
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
$data = [
'name' => 'New Bill ' . random_int(1000, 9999),
'name' => 'New Bill ' . $this->randomInt(),
'amount_min' => '100',
'transaction_currency_id' => 1,
'skip' => 0,
@@ -400,7 +400,7 @@ class BillControllerTest extends TestCase
$repository->shouldReceive('store')->andReturn(null);
$data = [
'name' => 'New Bill ' . random_int(1000, 9999),
'name' => 'New Bill ' . $this->randomInt(),
'amount_min' => '100',
'transaction_currency_id' => 1,
'skip' => 0,
@@ -437,7 +437,7 @@ class BillControllerTest extends TestCase
$attachHelper->shouldReceive('getMessages')->andReturn(new MessageBag);
$data = [
'name' => 'New Bill ' . random_int(1000, 9999),
'name' => 'New Bill ' . $this->randomInt(),
'amount_min' => '100',
'transaction_currency_id' => 1,
'skip' => 0,
@@ -476,7 +476,7 @@ class BillControllerTest extends TestCase
$data = [
'id' => 1,
'name' => 'Updated Bill ' . random_int(1000, 9999),
'name' => 'Updated Bill ' . $this->randomInt(),
'amount_min' => '100',
'transaction_currency_id' => 1,
'skip' => 0,

View File

@@ -91,7 +91,7 @@ class CreateControllerTest extends TestCase
$this->session(['budgets.create.uri' => 'http://localhost']);
$data = [
'name' => 'New Budget ' . random_int(1000, 9999),
'name' => 'New Budget ' . $this->randomInt(),
];
$this->be($this->user());
$response = $this->post(route('budgets.store'), $data);

View File

@@ -90,7 +90,7 @@ class EditControllerTest extends TestCase
$this->session(['budgets.edit.uri' => 'http://localhost']);
$data = [
'name' => 'Updated Budget ' . random_int(1000, 9999),
'name' => 'Updated Budget ' . $this->randomInt(),
'active' => 1,
];
$this->be($this->user());

View File

@@ -184,7 +184,7 @@ class CategoryControllerTest extends TestCase
$this->session(['categories.create.uri' => 'http://localhost']);
$data = [
'name' => 'New Category ' . random_int(1000, 9999),
'name' => 'New Category ' . $this->randomInt(),
];
$this->be($this->user());
$response = $this->post(route('categories.store'), $data);
@@ -212,7 +212,7 @@ class CategoryControllerTest extends TestCase
$this->session(['categories.edit.uri' => 'http://localhost']);
$data = [
'name' => 'Updated Category ' . random_int(1000, 9999),
'name' => 'Updated Category ' . $this->randomInt(),
'active' => 1,
];
$this->be($this->user());