mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
Ensure tests are running without Tidy
This commit is contained in:
@@ -19,6 +19,9 @@ class ReadabilityTested extends Readability
|
|||||||
|
|
||||||
class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @requires extension tidy
|
||||||
|
*/
|
||||||
public function testConstructDefault()
|
public function testConstructDefault()
|
||||||
{
|
{
|
||||||
$readability = new ReadabilityTested('');
|
$readability = new ReadabilityTested('');
|
||||||
@@ -30,6 +33,9 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertInstanceOf('DomDocument', $readability->dom);
|
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @requires extension tidy
|
||||||
|
*/
|
||||||
public function testConstructSimple()
|
public function testConstructSimple()
|
||||||
{
|
{
|
||||||
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
||||||
@@ -41,6 +47,28 @@ class ReadabilityTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertInstanceOf('DomDocument', $readability->dom);
|
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testConstructDefaultWithoutTidy()
|
||||||
|
{
|
||||||
|
$readability = new ReadabilityTested('', null, 'libxml', false);
|
||||||
|
|
||||||
|
$this->assertNull($readability->url);
|
||||||
|
$this->assertContains('Parsing URL', $readability->getDebugText());
|
||||||
|
$this->assertNotContains('Tidying document', $readability->getDebugText());
|
||||||
|
$this->assertNull($readability->getDomainRegexp());
|
||||||
|
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructSimpleWithoutTidy()
|
||||||
|
{
|
||||||
|
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0', 'libxml', false);
|
||||||
|
|
||||||
|
$this->assertEquals('http://0.0.0.0', $readability->url);
|
||||||
|
$this->assertContains('Parsing URL', $readability->getDebugText());
|
||||||
|
$this->assertNotContains('Tidying document', $readability->getDebugText());
|
||||||
|
$this->assertEquals('/0\.0\.0\.0/', $readability->getDomainRegexp());
|
||||||
|
$this->assertInstanceOf('DomDocument', $readability->dom);
|
||||||
|
}
|
||||||
|
|
||||||
public function testInitNoContent()
|
public function testInitNoContent()
|
||||||
{
|
{
|
||||||
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
$readability = new ReadabilityTested('<html/>', 'http://0.0.0.0');
|
||||||
|
|||||||
Reference in New Issue
Block a user