mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 22:58:09 +00:00
Expand test coverage and improve transaction management code.
This commit is contained in:
@@ -59,11 +59,11 @@ class IndexControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$repository->shouldReceive('moveDown');
|
||||
$this->mockDefaultSession();
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
@@ -81,11 +81,12 @@ class IndexControllerTest extends TestCase
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mockDefaultSession();
|
||||
$this->mockIntroPreference('shown_demo_rules_index');
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$ruleGroupRepos->shouldReceive('count')->andReturn(0);
|
||||
$ruleGroupRepos->shouldReceive('store');
|
||||
$repository->shouldReceive('getFirstRuleGroup')->andReturn(new RuleGroup);
|
||||
@@ -106,11 +107,10 @@ class IndexControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mockDefaultSession();
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
|
||||
$data = ['actions' => [1, 2, 3]];
|
||||
$repository->shouldReceive('reorderRuleActions')->once();
|
||||
@@ -127,11 +127,10 @@ class IndexControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mockDefaultSession();
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$data = ['triggers' => [1, 2, 3]];
|
||||
$repository->shouldReceive('reorderRuleTriggers')->once();
|
||||
|
||||
@@ -148,12 +147,11 @@ class IndexControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$repository = $this->mock(RuleRepositoryInterface::class);
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mockDefaultSession();
|
||||
|
||||
|
||||
$journalRepos->shouldReceive('firstNull')->once()->andReturn(new TransactionJournal);
|
||||
$repository->shouldReceive('moveUp');
|
||||
|
||||
$this->be($this->user());
|
||||
|
||||
Reference in New Issue
Block a user