审查视图

simplewind/vendor/electrolinux/phpquery/test-cases/test_scripts.php 942 字节
景龙 authored
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
<?php
//error_reporting(E_ALL);
require_once('../phpQuery/phpQuery.php');
phpQuery::$debug = true;
phpQuery::plugin('Scripts');


$testName = 'Scripts/example';
$doc = phpQuery::newDocumentFile('test.html');
$testResult = 10;
if ($doc->script('example', 'p')->length == $testResult)
	print "Test '$testName' PASSED :)";
else {
	print "Test '$testName' <strong>FAILED</strong> !!! ";
	print "<pre>";
	var_dump($doc->whois());
	print "</pre>\n";
}
print "\n";


$testName = 'Scripts/gmail_login';
$testResult = 1;
$url = 'http://code.google.com/p/phpquery/w/edit/MultiDocumentSupport';
//phpQuery::ajaxAllowURL($url);
$editor = phpQuery::newDocument('<div/>')
	->script('google_login')
	->location($url);
if ($editor->find('textarea#content')->length == $testResult)
	print "Test '$testName' PASSED :)";
else {
	print "Test '$testName' <strong>FAILED</strong> !!! ";
	print "<pre>";
	var_dump($doc->whois());
	print "</pre>\n";
}
print "\n";
?>