3 use Illuminate\Cache\ArrayStore;
4 use Illuminate\Support\Facades\Cache;
5 use Illuminate\Support\Facades\DB;
6 use Illuminate\Support\Facades\Session;
9 class StatusTest extends TestCase
11 public function test_returns_json_with_expected_results()
13 $resp = $this->get('/status');
14 $resp->assertStatus(200);
22 public function test_returns_500_status_and_false_on_db_error()
24 DB::shouldReceive('table')->andThrow(new Exception());
26 $resp = $this->get('/status');
27 $resp->assertStatus(500);
33 public function test_returns_500_status_and_false_on_wrong_cache_return()
35 $mockStore = Mockery::mock(new ArrayStore())->makePartial();
36 Cache::swap($mockStore);
37 $mockStore->shouldReceive('pull')->andReturn('cat');
39 $resp = $this->get('/status');
40 $resp->assertStatus(500);
46 public function test_returns_500_status_and_false_on_wrong_session_return()
48 $session = Session::getFacadeRoot();
49 $mockSession = Mockery::mock($session)->makePartial();
50 Session::swap($mockSession);
51 $mockSession->shouldReceive('get')->andReturn('cat');
53 $resp = $this->get('/status');
54 $resp->assertStatus(500);