3 use Illuminate\Support\Facades\DB;
4 use Illuminate\Support\Facades\Cache;
5 use Illuminate\Support\Facades\Session;
8 class StatusTest extends TestCase
10 public function test_returns_json_with_expected_results()
12 $resp = $this->get("/status");
13 $resp->assertStatus(200);
21 public function test_returns_500_status_and_false_on_db_error()
23 DB::shouldReceive('table')->andThrow(new Exception());
25 $resp = $this->get("/status");
26 $resp->assertStatus(500);
32 public function test_returns_500_status_and_false_on_wrong_cache_return()
34 Cache::partialMock()->shouldReceive('get')->andReturn('cat');
36 $resp = $this->get("/status");
37 $resp->assertStatus(500);
43 public function test_returns_500_status_and_false_on_wrong_session_return()
45 $session = Session::getFacadeRoot();
46 $mockSession = Mockery::mock($session)->makePartial();
47 Session::swap($mockSession);
48 $mockSession->shouldReceive('get')->andReturn('cat');
50 $resp = $this->get("/status");
51 $resp->assertStatus(500);