| 
<?phprequire 'class.Xidel.php';
 
 class XidelTest extends PHPUnit_Framework_TestCase {
 
 private $xidel = null;
 
 public function __construct() {
 $this->xidel = new Xidel('https://www.4chan.org/');
 $this->xidel->setInputFormat(Xidel::INPUT_FORMAT_HTML);
 $this->xidel->setOutputEncoding(Xidel::OUTPUT_ENCODING_UTF8);
 $this->xidel->setOutputFormat(Xidel::OUTPUT_FORMAT_ADHOC);
 }
 
 public function testLinkCSS() {
 $this->xidel->setExtract('a[title="Home"]');
 $content = $this->xidel->process();
 
 $this->assertEquals("4chan", $content);
 }
 
 public function testLinkXPath() {
 $this->xidel->reset();
 $this->xidel->setExtract('//a[@href="/contact"]', Xidel::EXTRACT_KIND_XPATH);
 $content = $this->xidel->process();
 
 $this->assertEquals("Contact", $content);
 }
 
 public function testLinksXPath() {
 $this->xidel->reset();
 $this->xidel->setExtract('//*[@id="ft"]/ul/li/a', Xidel::EXTRACT_KIND_XPATH);
 $content = $this->xidel->process();
 
 $this->assertEquals(array("Home", "News", "Blog", "FAQ", "Rules", "Advertise", "Press"), $content);
 }
 }
 
 |