6 use Illuminate\Cache\ArrayStore;
7 use Illuminate\Support\Facades\Cache;
8 use Illuminate\Support\Facades\DB;
9 use Illuminate\Support\Facades\Session;
12 class StatusTest extends TestCase
14 public function test_returns_json_with_expected_results()
16 $resp = $this->get('/status');
17 $resp->assertStatus(200);
25 public function test_returns_500_status_and_false_on_db_error()
27 DB::shouldReceive('table')->andThrow(new Exception());
29 $resp = $this->get('/status');
30 $resp->assertStatus(500);
36 public function test_returns_500_status_and_false_on_wrong_cache_return()
38 $mockStore = Mockery::mock(new ArrayStore())->makePartial();
39 Cache::swap($mockStore);
40 $mockStore->shouldReceive('pull')->andReturn('cat');
42 $resp = $this->get('/status');
43 $resp->assertStatus(500);
49 public function test_returns_500_status_and_false_on_wrong_session_return()
51 $session = Session::getFacadeRoot();
52 $mockSession = Mockery::mock($session)->makePartial();
53 Session::swap($mockSession);
54 $mockSession->shouldReceive('get')->andReturn('cat');
56 $resp = $this->get('/status');
57 $resp->assertStatus(500);