3 use Illuminate\Foundation\Testing\DatabaseTransactions;
4 use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
6 abstract class TestCase extends BaseTestCase
8 use CreatesApplication;
9 use DatabaseTransactions;
10 use SharedTestHelpers;
13 * The base URL to use while testing the application.
16 protected $baseUrl = 'http://localhost';
19 * Assert a permission error has occurred.
20 * @param TestResponse $response
23 protected function assertPermissionError(TestResponse $response)
25 $response->assertRedirect('/');
26 $this->assertSessionHas('error');
27 session()->remove('error');
32 * Assert the session contains a specific entry.
36 protected function assertSessionHas(string $key)
38 $this->assertTrue(session()->has($key), "Session does not contain a [{$key}] entry");
43 * Override of the get method so we can get visibility of custom TestResponse methods.
45 * @param array $headers
46 * @return TestResponse
48 public function get($uri, array $headers = [])
50 return parent::get($uri, $headers);
54 * Create the test response instance from the given response.
56 * @param \Illuminate\Http\Response $response
57 * @return TestResponse
59 protected function createTestResponse($response)
61 return TestResponse::fromBaseResponse($response);