| @@ 24-38 (lines=15) @@ | ||
| 21 | $response->assertSee($expectedResult); |
|
| 22 | } |
|
| 23 | ||
| 24 | public function testSuccessfulDrip() |
|
| 25 | { |
|
| 26 | $dripRoute = config('genealabs-laravel-caffeine.route', 'genealabs/laravel-caffeine/drip'); |
|
| 27 | $html = $this->get(route('genealabs-laravel-caffeine.tests.form')) |
|
| 28 | ->getContent(); |
|
| 29 | $matches = []; |
|
| 30 | preg_match('/<meta name="csrf-token" content="(.*?)">/', $html, $matches); |
|
| 31 | $csrfToken = $matches[1]; |
|
| 32 | ||
| 33 | $response = $this->get($dripRoute, [ |
|
| 34 | '_token' => $csrfToken, |
|
| 35 | ]); |
|
| 36 | ||
| 37 | $response->assertStatus(204); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function testExpiredDrip() |
|
| 41 | { |
|
| @@ 40-55 (lines=16) @@ | ||
| 37 | $response->assertStatus(204); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function testExpiredDrip() |
|
| 41 | { |
|
| 42 | $dripRoute = config('genealabs-laravel-caffeine.dripInterval', 'genealabs/laravel-caffeine/drip'); |
|
| 43 | $html = $this->get(route('genealabs-laravel-caffeine.tests.form')) |
|
| 44 | ->getContent(); |
|
| 45 | $matches = []; |
|
| 46 | preg_match('/<meta name="csrf-token" content="(.*?)">/', $html, $matches); |
|
| 47 | $csrfToken = $matches[1]; |
|
| 48 | ||
| 49 | app('session')->flush(); |
|
| 50 | $response = $this->get($dripRoute, [ |
|
| 51 | '_token' => $csrfToken, |
|
| 52 | ]); |
|
| 53 | ||
| 54 | $response->assertStatus(404); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||