Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
24 | public function testExtractFileAsText() |
||
25 | { |
||
26 | // Create a copy of the file, as it may be clobbered by the test |
||
27 | // ($file->extractFileAsText() calls $file->write) |
||
28 | copy(BASE_PATH.'/textextraction/tests/fixtures/test1.html', BASE_PATH.'/textextraction/tests/fixtures/test1-copy.html'); |
||
29 | |||
30 | // Use HTML, since the extractor is always available |
||
31 | $file = new File(array( |
||
32 | 'Name' => 'test1-copy.html', |
||
33 | 'Filename' => 'textextraction/tests/fixtures/test1-copy.html' |
||
34 | )); |
||
35 | $file->write(); |
||
36 | |||
37 | $content = $file->extractFileAsText(); |
||
38 | $this->assertContains('Test Headline', $content); |
||
39 | $this->assertContains('Test Text', $content); |
||
40 | $this->assertEquals($content, $file->FileContentCache); |
||
41 | |||
42 | if (file_exists(BASE_PATH.'/textextraction/tests/fixtures/test1-copy.html')) { |
||
43 | unlink(BASE_PATH.'/textextraction/tests/fixtures/test1-copy.html'); |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |
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.