silverstripe-textextraction/tests/PDFTextExtractorTest.php

23 lines
726 B
PHP
Raw Normal View History

2012-08-22 18:23:06 +02:00
<?php
namespace SilverStripe\TextExtraction\Tests;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\TextExtraction\Extractor\FileTextExtractor\Exception;
use SilverStripe\TextExtraction\Extractor\PDFTextExtractor;
2015-11-18 05:07:31 +01:00
class PDFTextExtractorTest extends SapphireTest
{
public function testExtraction()
{
$extractor = new PDFTextExtractor();
if (!$extractor->isAvailable()) {
$this->expectException(Exception::class);
$this->expectExceptionMessage('getRawOutput called on unavailable extractor');
2015-11-18 05:07:31 +01:00
}
2012-08-22 18:23:06 +02:00
$content = $extractor->getContent(dirname(__FILE__) . '/fixtures/test1.pdf');
2015-11-18 05:07:31 +01:00
$this->assertContains('This is a test file with a link', $content);
}
}