审查视图

simplewind/vendor/electrolinux/phpquery/test-cases/test_arrayaccess.php 1.0 KB
景龙 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
<?php
//error_reporting(E_ALL);
set_include_path(
	get_include_path()
	.':/home/bob/Sources/PHP/zend-framework/'
);

require_once('../phpQuery/phpQuery.php');
phpQuery::$debug = true;
$testHtml = phpQuery::newDocumentFile('test.html');
$testHtml['li:first']->append('<span class="just-added">test</span>');
$testName = 'Array Access get';
if (trim($testHtml['.just-added']->html()) == 'test')
	print "Test '$testName' PASSED :)";
else {
	print "Test '$testName' <strong>FAILED</strong> !!! ";
	print "<pre>";
	print_r($testHtml['.just-added']->whois());
	print "</pre>\n";
}
print "\n";

require_once('../phpQuery/phpQuery.php');
phpQuery::$debug = true;
$testHtml = phpQuery::newDocumentFile('test.html');
$testHtml['li:first'] = 'new inner html';
$testName = 'Array Access set';
if (trim($testHtml['li:first']->html()) == 'new inner html')
	print "Test '$testName' PASSED :)";
else {
	print "Test '$testName' <strong>FAILED</strong> !!! ";
	print "<pre>";
	print_r($testHtml['.just-added']->whois());
	print "</pre>\n";
}
print "\n";