diff --git a/.travis.yml b/.travis.yml index 0b96f17..236155b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,16 +10,14 @@ addons: matrix: include: - - php: 5.4 - env: DB=PGSQL CORE_RELEASE=3.2 - php: 5.5 - env: DB=PGSQL CORE_RELEASE=3.3 + env: DB=PGSQL CORE_RELEASE=3.7 - php: 5.6 - env: DB=PGSQL CORE_RELEASE=3.4 + env: DB=PGSQL CORE_RELEASE=3.7 - php: 5.6 - env: DB=MYSQL CORE_RELEASE=3.5 + env: DB=MYSQL CORE_RELEASE=3.7 - php: 7.0 - env: DB=MYSQL CORE_RELEASE=3.6 + env: DB=MYSQL CORE_RELEASE=3.7 - php: 7.1 env: DB=MYSQL CORE_RELEASE=3 diff --git a/_config.php b/_config.php deleted file mode 100644 index e69de29..0000000 diff --git a/code/extractors/FileTextExtractor.php b/code/extractors/FileTextExtractor.php index cc7c176..ddd3c5e 100644 --- a/code/extractors/FileTextExtractor.php +++ b/code/extractors/FileTextExtractor.php @@ -5,7 +5,7 @@ * @author mstephens * */ -abstract class FileTextExtractor extends Object +abstract class FileTextExtractor extends SS_Object { /** * Set priority from 0-100. @@ -34,7 +34,7 @@ abstract class FileTextExtractor extends Object if (self::$sorted_extractor_classes) { return self::$sorted_extractor_classes; } - + // Generate the sorted list of extractors on demand. $classes = ClassInfo::subclassesFor("FileTextExtractor"); array_shift($classes); @@ -108,7 +108,7 @@ abstract class FileTextExtractor extends Object /** * Checks if the extractor is supported on the current environment, * for example if the correct binaries or libraries are available. - * + * * @return boolean */ abstract public function isAvailable(); @@ -125,7 +125,7 @@ abstract class FileTextExtractor extends Object /** * Determine if this extractor suports the given mime type. * Will only be called if supportsExtension returns false. - * + * * @param string $mime * @return boolean */ @@ -133,7 +133,7 @@ abstract class FileTextExtractor extends Object /** * Given a file path, extract the contents as text. - * + * * @param string $path * @return string */ diff --git a/composer.json b/composer.json index f8a6ea8..5b3a1e5 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.2", "composer/installers": "*", - "silverstripe/framework": "^3.1", + "silverstripe/framework": "^3.7", "guzzle/guzzle": "^3.9", "symfony/event-dispatcher": "^2.6.0@stable", "symfony/http-foundation": "^2.6.0" diff --git a/tests/FileTextExtractableTest.php b/tests/FileTextExtractableTest.php index 166b1ee..3cf6798 100644 --- a/tests/FileTextExtractableTest.php +++ b/tests/FileTextExtractableTest.php @@ -26,15 +26,16 @@ class FileTextExtractableTest extends SapphireTest // Create a copy of the file, as it may be clobbered by the test // ($file->extractFileAsText() calls $file->write) copy(BASE_PATH.'/textextraction/tests/fixtures/test1.html', BASE_PATH.'/textextraction/tests/fixtures/test1-copy.html'); - + // Use HTML, since the extractor is always available + /** @var File&FileTextExtractable $file */ $file = new File(array( 'Name' => 'test1-copy.html', 'Filename' => 'textextraction/tests/fixtures/test1-copy.html' )); $file->write(); - - $content = $file->extractFileAsText(); + + $content = (string) $file->extractFileAsText(); $this->assertContains('Test Headline', $content); $this->assertContains('Test Text', $content); $this->assertEquals($content, $file->FileContentCache);