Fix rule validation issues.

This commit is contained in:
James Cole
2017-09-03 15:57:13 +02:00
parent 49c5c9ba15
commit d9dad4387e
4 changed files with 33 additions and 13 deletions

View File

@@ -243,13 +243,12 @@ class RuleControllerTest extends TestCase
public function testStore()
{
// mock stuff
$repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
$repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$ruleGroupRepos->shouldReceive('find')->andReturn(new RuleGroup)->once();
$repository->shouldReceive('store')->andReturn(new Rule);
$repository->shouldReceive('find')->withArgs([0])->andReturn(new Rule)->once();
$this->session(['rules.create.uri' => 'http://localhost']);
$data = [
@@ -375,12 +374,11 @@ class RuleControllerTest extends TestCase
public function testUpdate()
{
// mock stuff
$repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$ruleGroupRepos = $this->mock(RuleGroupRepositoryInterface::class);
$repository = $this->mock(RuleRepositoryInterface::class);
$journalRepos = $this->mock(JournalRepositoryInterface::class);
$rule = Rule::find(1);
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
$ruleGroupRepos->shouldReceive('find')->andReturn(new RuleGroup)->once();
$repository->shouldReceive('find')->withArgs([1])->andReturn($rule)->once();
$repository->shouldReceive('update');
$data = [