silverstripe-textextraction/tests/HTMLTextExtractorTest.php

22 lines
713 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\HTMLTextExtractor;
2015-11-18 05:07:31 +01:00
class HTMLTextExtractorTest extends SapphireTest
{
public function testExtraction()
{
$extractor = new HTMLTextExtractor();
2012-08-22 18:23:06 +02:00
$content = $extractor->getContent(dirname(__FILE__) . '/fixtures/test1.html');
2015-11-18 05:07:31 +01:00
$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');
}
}