Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
class PHPricot_ToTextTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testHeader1() | ||
{ | ||
$query = new PHPricot_Query('<h1>Foo</h1><p>bar <a href="#foo">baz</a></p>'); | ||
|
||
$expected = <<<ETT | ||
***************************************************************** | ||
Foo | ||
***************************************************************** | ||
bar baz | ||
ETT; | ||
$this->assertEquals($expected, $query->getDocument()->toText()); | ||
} | ||
|
||
public function testHeader2() | ||
{ | ||
$query = new PHPricot_Query('<h2>Foo</h2>'); | ||
|
||
$expected = <<<ETT | ||
----------------------------------------------------------------- | ||
Foo | ||
----------------------------------------------------------------- | ||
ETT; | ||
$this->assertEquals($expected, $query->getDocument()->toText()); | ||
} | ||
|
||
|
||
public function testHeader3() | ||
{ | ||
$query = new PHPricot_Query('<h3>Foo</h3>'); | ||
|
||
$expected = <<<ETT | ||
Foo | ||
----------------------------------------------------------------- | ||
ETT; | ||
$this->assertEquals($expected, $query->getDocument()->toText()); | ||
} | ||
|
||
public function testList() | ||
{ | ||
$query = new PHPricot_Query('<ul><li>Foo</li><li>Bar</li></ul>'); | ||
|
||
$expected = <<<ETT | ||
* Foo | ||
* Bar | ||
ETT; | ||
$this->assertEquals($expected, $query->getDocument()->toText()); | ||
} | ||
} |