| @@ 12-19 (lines=8) @@ | ||
| 9 | $result = PhpQuery::newDocumentFile('test.html') |
|
| 10 | ->find('li') |
|
| 11 | ->slice(1, 2); |
|
| 12 | if ( $result->whois() == $testResult ) |
|
| 13 | print "Test 'Slice1' PASSED :)"; |
|
| 14 | else { |
|
| 15 | print "Test 'Slice1' <strong>FAILED</strong> !!! "; |
|
| 16 | print "<pre>"; |
|
| 17 | print_r($result->whois()); |
|
| 18 | print "</pre>\n"; |
|
| 19 | } |
|
| 20 | print "\n"; |
|
| 21 | ||
| 22 | // SLICE2 |
|
| @@ 32-39 (lines=8) @@ | ||
| 29 | $result = PhpQuery::newDocumentFile('test.html') |
|
| 30 | ->find('li') |
|
| 31 | ->slice(1, -1); |
|
| 32 | if ( $result->whois() == $testResult ) |
|
| 33 | print "Test 'Slice2' PASSED :)"; |
|
| 34 | else { |
|
| 35 | print "Test 'Slice2' <strong>FAILED</strong> !!! "; |
|
| 36 | print "<pre>"; |
|
| 37 | print_r($result->whois()); |
|
| 38 | print "</pre>\n"; |
|
| 39 | } |
|
| 40 | print "\n"; |
|
| 41 | ||
| 42 | // Multi-insert |
|
| @@ 37-44 (lines=8) @@ | ||
| 34 | $testName = is_array($test) |
|
| 35 | ? $test[1] |
|
| 36 | : $test; |
|
| 37 | if ( $result->whois() == $testResult ) |
|
| 38 | print "Test '$testName' PASSED :)"; |
|
| 39 | else { |
|
| 40 | print "Test '$testName' <strong>FAILED</strong> !!! "; |
|
| 41 | print "<pre>"; |
|
| 42 | print_r($result->whois()); |
|
| 43 | print "</pre>\n"; |
|
| 44 | } |
|
| 45 | print "\n"; |
|
| 46 | } |
|
| 47 | ?> |
|