| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 17 |
| Ratio | 100 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | View Code Duplication | public function testExtraction() |
|
| 9 | { |
||
| 10 | $extractor = new TikaTextExtractor(); |
||
| 11 | if (!$extractor->isAvailable()) { |
||
| 12 | $this->markTestSkipped('tika cli not available'); |
||
| 13 | } |
||
| 14 | |||
| 15 | // Check file |
||
| 16 | $file = Director::baseFolder() . '/textextraction/tests/fixtures/test1.pdf'; |
||
| 17 | $content = $extractor->getContent($file); |
||
| 18 | $this->assertContains('This is a test file with a link', $content); |
||
| 19 | |||
| 20 | // Check mime validation |
||
| 21 | $this->assertTrue($extractor->supportsMime('application/pdf')); |
||
| 22 | $this->assertTrue($extractor->supportsMime('text/html')); |
||
| 23 | $this->assertFalse($extractor->supportsMime('application/not-supported')); |
||
| 24 | } |
||
| 25 | |||
| 44 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.