Code cleanup and tests.

This commit is contained in:
James Cole
2017-07-23 08:32:51 +02:00
parent 8bb7d5de3f
commit f85ab74e2b
15 changed files with 72 additions and 90 deletions

View File

@@ -56,12 +56,9 @@ class HelpControllerTest extends TestCase
$help->shouldReceive('getFromGithub')->withArgs(['index', 'nl_NL'])->andReturn('')->once();
// is US in cache?
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(true)->twice();
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(true)->once();
$help->shouldReceive('getFromCache')->withArgs(['index', 'en_US'])->andReturn('US from cache.')->once();
// put US in cache:
$help->shouldReceive('putInCache')->once();
$this->be($this->user());
$response = $this->get(route('help.show', ['index']));
$response->assertStatus(200);
@@ -87,12 +84,9 @@ class HelpControllerTest extends TestCase
$help->shouldReceive('getFromGithub')->withArgs(['index', 'nl_NL'])->andReturn('')->once();
// is US in cache?
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(false)->twice();
$help->shouldReceive('inCache')->withArgs(['index', 'en_US'])->andReturn(false)->once();
$help->shouldReceive('getFromGithub')->withArgs(['index', 'en_US'])->andReturn('')->once();
// put US in cache:
$help->shouldReceive('putInCache')->once();
$this->be($this->user());
$response = $this->get(route('help.show', ['index']));
$response->assertStatus(200);