mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
API phpunit 9 support
This commit is contained in:
parent
90d4812aa8
commit
b92616eb4e
@ -20,14 +20,15 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"silverstripe/framework": "^4",
|
||||
"php": "^7.3 || ^8.0",
|
||||
"silverstripe/framework": "^4.10",
|
||||
"silverstripe/assets": "^1",
|
||||
"silverstripe/versioned": "^1",
|
||||
"guzzlehttp/guzzle": "~6.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3",
|
||||
"sminnee/phpunit": "^5.7"
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -1,7 +1,9 @@
|
||||
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
|
||||
<testsuite name="Default">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
<testsuites>
|
||||
<testsuite name="Default">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
|
@ -18,7 +18,7 @@ class FileTextExtractableTest extends SapphireTest
|
||||
],
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -33,7 +33,7 @@ class FileTextExtractableTest extends SapphireTest
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (file_exists(dirname(__FILE__) . '/fixtures/test1-copy.html')) {
|
||||
unlink(dirname(__FILE__) . '/fixtures/test1-copy.html');
|
||||
@ -53,8 +53,8 @@ class FileTextExtractableTest extends SapphireTest
|
||||
|
||||
$content = $file->extractFileAsText();
|
||||
$this->assertNotNull($content);
|
||||
$this->assertContains('Test Headline', $content);
|
||||
$this->assertContains('Test Text', $content);
|
||||
$this->assertStringContainsString('Test Headline', $content);
|
||||
$this->assertStringContainsString('Test Text', $content);
|
||||
$this->assertEquals($content, $file->FileContentCache);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class HTMLTextExtractorTest extends SapphireTest
|
||||
{
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -28,9 +28,9 @@ class HTMLTextExtractorTest extends SapphireTest
|
||||
|
||||
$content = $extractor->getContent($file);
|
||||
|
||||
$this->assertContains('Test Headline', $content);
|
||||
$this->assertNotContains('Test Comment', $content, 'Strips HTML comments');
|
||||
$this->assertNotContains('Test Style', $content, 'Strips non-content style tags');
|
||||
$this->assertNotContains('Test Script', $content, 'Strips non-content script tags');
|
||||
$this->assertStringContainsString('Test Headline', $content);
|
||||
$this->assertStringNotContainsString('Test Comment', $content, 'Strips HTML comments');
|
||||
$this->assertStringNotContainsString('Test Style', $content, 'Strips non-content style tags');
|
||||
$this->assertStringNotContainsString('Test Script', $content, 'Strips non-content script tags');
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,6 @@ class PDFTextExtractorTest extends SapphireTest
|
||||
$file->write();
|
||||
|
||||
$content = $extractor->getContent($file);
|
||||
$this->assertContains('This is a test file with a link', $content);
|
||||
$this->assertStringContainsString('This is a test file with a link', $content);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace SilverStripe\TextExtraction\Tests;
|
||||
|
||||
use PHPUnit_Framework_MockObject_MockObject;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\TextExtraction\Extractor\TikaServerTextExtractor;
|
||||
@ -28,7 +28,7 @@ class TikaServerTextExtractorTest extends SapphireTest
|
||||
$file->write();
|
||||
|
||||
$content = $extractor->getContent($file);
|
||||
$this->assertContains('This is a test file with a link', $content);
|
||||
$this->assertStringContainsString('This is a test file with a link', $content);
|
||||
|
||||
// Check mime validation
|
||||
$this->assertTrue($extractor->supportsMime('application/pdf'));
|
||||
@ -43,7 +43,7 @@ class TikaServerTextExtractorTest extends SapphireTest
|
||||
*/
|
||||
public function testIsAvailable($version, $expected)
|
||||
{
|
||||
/** @var PHPUnit_Framework_MockObject_MockObject|TikaServerTextExtractor $extractor */
|
||||
/** @var MockObject|TikaServerTextExtractor $extractor */
|
||||
$extractor = $this->getMockBuilder(TikaServerTextExtractor::class)
|
||||
->setMethods(['getClient', 'getServerEndpoint'])
|
||||
->getMock();
|
||||
|
@ -28,7 +28,7 @@ class TikaTextExtractorTest extends SapphireTest
|
||||
$file->write();
|
||||
|
||||
$content = $extractor->getContent($file);
|
||||
$this->assertContains('This is a test file with a link', $content);
|
||||
$this->assertStringContainsString('This is a test file with a link', $content);
|
||||
|
||||
// Check mime validation
|
||||
$this->assertTrue($extractor->supportsMime('application/pdf'));
|
||||
|
Loading…
Reference in New Issue
Block a user