]> BookStack Code Mirror - bookstack/blob - tests/TestCase.php
Fix pt_BR translations
[bookstack] / tests / TestCase.php
1 <?php namespace Tests;
2
3 use Illuminate\Foundation\Testing\DatabaseTransactions;
4 use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
5
6 abstract class TestCase extends BaseTestCase
7 {
8     use CreatesApplication;
9     use DatabaseTransactions;
10     use SharedTestHelpers;
11
12     /**
13      * The base URL to use while testing the application.
14      * @var string
15      */
16     protected $baseUrl = 'http://localhost';
17
18     /**
19      * Assert a permission error has occurred.
20      * @param TestResponse $response
21      * @return TestCase
22      */
23     protected function assertPermissionError(TestResponse $response)
24     {
25         $response->assertRedirect('/');
26         $this->assertSessionHas('error');
27         session()->remove('error');
28         return $this;
29     }
30
31     /**
32      * Assert the session contains a specific entry.
33      * @param string $key
34      * @return $this
35      */
36     protected function assertSessionHas(string $key)
37     {
38         $this->assertTrue(session()->has($key), "Session does not contain a [{$key}] entry");
39         return $this;
40     }
41
42     /**
43      * Override of the get method so we can get visibility of custom TestResponse methods.
44      * @param  string  $uri
45      * @param  array  $headers
46      * @return TestResponse
47      */
48     public function get($uri, array $headers = [])
49     {
50         return parent::get($uri, $headers);
51     }
52
53     /**
54      * Create the test response instance from the given response.
55      *
56      * @param  \Illuminate\Http\Response $response
57      * @return TestResponse
58      */
59     protected function createTestResponse($response)
60     {
61         return TestResponse::fromBaseResponse($response);
62     }
63 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.