|
4 | 4 |
|
5 | 5 | use SilverStripe\Assets\Dev\TestAssetStore; |
6 | 6 | use SilverStripe\Assets\File; |
7 | | -use SilverStripe\Core\Environment; |
8 | 7 | use SilverStripe\Dev\SapphireTest; |
9 | 8 | use SilverStripe\Forager\Extensions\SearchServiceExtension; |
10 | 9 | use SilverStripe\ForagerBifrost\Extensions\FileExtension; |
@@ -34,6 +33,25 @@ public function testDescription(): void |
34 | 33 | 'Documents excluded for content ingestion in Silverstripe Search which exceeds 15 MB', |
35 | 34 | $report->description() |
36 | 35 | ); |
| 36 | + |
| 37 | + // Removing extension should result in a new description |
| 38 | + $this->removeFileExtension(); |
| 39 | + $this->assertEquals( |
| 40 | + 'This report requires the FileExtension being applied to Files.', |
| 41 | + $report->description() |
| 42 | + ); |
| 43 | + |
| 44 | + } |
| 45 | + |
| 46 | + public function testCanView(): void |
| 47 | + { |
| 48 | + $report = new LargeDocumentReport(); |
| 49 | + |
| 50 | + $this->assertTrue($report->canView()); |
| 51 | + |
| 52 | + // When the extension is not present on the File then the report should not be viewable |
| 53 | + $this->removeFileExtension(); |
| 54 | + $this->assertfalse($report->canView()); |
37 | 55 | } |
38 | 56 |
|
39 | 57 | public function testColumns(): void |
@@ -70,12 +88,16 @@ public function testSourceRecords(): void |
70 | 88 | $this->assertEquals($file21MbId, $files->first()->ID); |
71 | 89 | } |
72 | 90 |
|
| 91 | + protected function removeFileExtension(): void |
| 92 | + { |
| 93 | + File::remove_extension(FileExtension::class); |
| 94 | + } |
| 95 | + |
73 | 96 | protected function setUp(): void |
74 | 97 | { |
75 | 98 | parent::setUp(); |
76 | 99 |
|
77 | 100 | TestAssetStore::activate('SearchFileTest'); |
78 | | - Environment::setEnv('SEARCH_INDEX_FILES', 1); |
79 | 101 | } |
80 | 102 |
|
81 | 103 | protected function tearDown(): void |
|
0 commit comments