|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Tests; |
| 4 | + |
| 5 | +class SessionTest extends TestCase |
| 6 | +{ |
| 7 | + public function test_secure_images_not_tracked_in_session_history() |
| 8 | + { |
| 9 | + config()->set('filesystems.images', 'local_secure'); |
| 10 | + $this->asEditor(); |
| 11 | + $page = $this->entities->page(); |
| 12 | + $result = $this->files->uploadGalleryImageToPage($this, $page); |
| 13 | + $expectedPath = storage_path($result['path']); |
| 14 | + $this->assertFileExists($expectedPath); |
| 15 | + |
| 16 | + $this->get('/books'); |
| 17 | + $this->assertEquals(url('/books'), session()->previousUrl()); |
| 18 | + |
| 19 | + $resp = $this->get($result['path']); |
| 20 | + $resp->assertOk(); |
| 21 | + $resp->assertHeader('Content-Type', 'image/png'); |
| 22 | + |
| 23 | + $this->assertEquals(url('/books'), session()->previousUrl()); |
| 24 | + |
| 25 | + if (file_exists($expectedPath)) { |
| 26 | + unlink($expectedPath); |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + public function test_pwa_manifest_is_not_tracked_in_session_history() |
| 31 | + { |
| 32 | + $this->asEditor()->get('/books'); |
| 33 | + $this->get('/manifest.json'); |
| 34 | + |
| 35 | + $this->assertEquals(url('/books'), session()->previousUrl()); |
| 36 | + } |
| 37 | + |
| 38 | + public function test_dist_dir_access_is_not_tracked_in_session_history() |
| 39 | + { |
| 40 | + $this->asEditor()->get('/books'); |
| 41 | + $this->get('/dist/sub/hello.txt'); |
| 42 | + |
| 43 | + $this->assertEquals(url('/books'), session()->previousUrl()); |
| 44 | + } |
| 45 | + |
| 46 | + public function test_opensearch_is_not_tracked_in_session_history() |
| 47 | + { |
| 48 | + $this->asEditor()->get('/books'); |
| 49 | + $this->get('/opensearch.xml'); |
| 50 | + |
| 51 | + $this->assertEquals(url('/books'), session()->previousUrl()); |
| 52 | + } |
| 53 | +} |
0 commit comments