Improve code quality and fix test coverage.

This commit is contained in:
James Cole
2018-04-28 10:27:33 +02:00
parent 7b39828980
commit e126427809
75 changed files with 430 additions and 369 deletions

View File

@@ -48,7 +48,7 @@ class RuleGroupControllerTest extends TestCase
public function setUp()
{
parent::setUp();
Log::debug(sprintf('Now in %s.', get_class($this)));
Log::debug(sprintf('Now in %s.', \get_class($this)));
}
@@ -60,7 +60,7 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('rule-groups.create'));
@@ -76,7 +76,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('get')->andReturn(new Collection);
$this->be($this->user());
@@ -93,7 +93,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('destroy');
$this->session(['rule-groups.delete.uri' => 'http://localhost']);
@@ -112,7 +112,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveDown');
$this->be($this->user());
@@ -128,7 +128,7 @@ class RuleGroupControllerTest extends TestCase
{
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->be($this->user());
$response = $this->get(route('rule-groups.edit', [1]));
@@ -144,7 +144,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
$this->expectsJobs(ExecuteRuleGroupOnExistingTransactions::class);
@@ -171,7 +171,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$accountRepos->shouldReceive('getAccountsByType')->andReturn(new Collection);
$this->be($this->user());
@@ -189,7 +189,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$this->session(['rule-groups.create.uri' => 'http://localhost']);
$repository->shouldReceive('store')->andReturn(new RuleGroup);
@@ -213,7 +213,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$repository->shouldReceive('moveUp');
$this->be($this->user());
@@ -231,7 +231,7 @@ class RuleGroupControllerTest extends TestCase
// mock stuff
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$repository = $this->mock(RuleGroupRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
$data = [
'id' => 1,