summaryrefslogtreecommitdiff
path: root/lib/querypath/test/Tests/QueryPath/QueryPathTest.php
blob: 71fd225584376db7d15a1d484fc1d1842d6e9fae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace QueryPath\Tests;

//require_once 'PHPUnit/Autoload.php';
require_once __DIR__ . '/TestCase.php';
//require_once __DIR__ . '/../../../src/qp.php';
require_once __DIR__ . '/../../../src/QueryPath.php';

class QueryPathTest extends TestCase {

  public function testWith() {
    $qp = \QueryPath::with(\QueryPath::XHTML_STUB);

    $this->assertInstanceOf('\QueryPath\DOMQuery', $qp);

  }

  public function testWithHTML() {
    $qp = \QueryPath::with(\QueryPath::HTML_STUB);

    $this->assertInstanceOf('\QueryPath\DOMQuery', $qp);
  }
  public function testWithHTML5() {
    $qp = \QueryPath::withHTML5(\QueryPath::HTML5_STUB);

    $this->assertInstanceOf('\QueryPath\DOMQuery', $qp);
  }

  public function testWithXML() {
    $qp = \QueryPath::with(\QueryPath::XHTML_STUB);

    $this->assertInstanceOf('\QueryPath\DOMQuery', $qp);
  }

  public function testEnable() {
    \QueryPath::enable('\QueryPath\Tests\DummyExtension');

    $qp = \QueryPath::with(\QueryPath::XHTML_STUB);

    $this->assertTrue($qp->grrrrrrr());

  }

}

class DummyExtension implements \QueryPath\Extension {

  public function __construct(\QueryPath\Query $qp) {
    $this->qp = $qp;
  }

  public function grrrrrrr() {
    return TRUE;
  }

}