mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 09:06:00 +00:00
Merge pull request #50 from catalyst/upgrade/37
MINOR: module support for Silverstripe 3.7
This commit is contained in:
commit
9b18755977
10
.travis.yml
10
.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
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user