find('li:first') ->find('p:first') ->html('żźć'); if (trim($result->html()) == 'żźć') print "Test '{$testName}' passed :)
\n"; else print "Test '{$testName}' FAILED !!!
\n"; print "\n"; $testName = 'Text node HTML entite append'; $result = phpQuery::newDocumentFile('test.html') ->find('li:first') ->find('p:first') ->_empty() ->append('é'); if (trim($result->html()) == 'é') print "Test '{$testName}' passed :)
\n"; else { print "Test '{$testName}' FAILED !!!
\n"; print $result->html(); } print "\n"; $testName = 'DOMElement node HTML entite append'; $result = phpQuery::newDocumentFile('test.html') ->find('li:first') ->find('p:first') ->empty() ->append('é'); if (trim($result->html()) == 'é') print "Test '{$testName}' passed :)
\n"; else { print "Test '{$testName}' FAILED !!!
\n"; print $result->html(); } print "\n"; $testName = 'Append and move'; $result = phpQuery::newDocumentFile('test.html'); $li = $result->find('li:first'); $result->find('div')->_empty(); $li->html('test1-é-test1') ->append('test2-é-test2') ->appendTo( $result->find('div:first') ); $result = $result->find('div:first li:first'); $expected = 'test1-é-test1test2-é-test2'; if (trim(str_replace("\n", '', $result->html())) == $expected) print "Test '{$testName}' passed :)
\n"; else { print "Test '{$testName}' FAILED !!!
\n"; print "'".trim($result->html())."'"; } print "\n"; $testName = 'Attr charset'; $result = phpQuery::newDocumentFile('test.html') ->find('li:first') ->attr('test', 'foo é żźć bar'); if (trim($result->attr('test')) == 'foo é żźć bar') print "Test '{$testName}' passed :)
\n"; else { print "Test '{$testName}' FAILED !!!
\n"; print $result->attr('test'); } print "\n"; //$testName = 'Loading document without meta charset'; //$result = phpQuery::newDocumentFile('test.html') // ->_empty(); ////var_dump((string)$result->htmlOuter()); //$result = phpQuery::newDocument($result->htmlOuter()); //$validResult = << // //EOF; //$similarity = 0; //similar_text($result->htmlOuter(), $validResult, $similarity); //if ( $similarity > 90 ) // print "Test '{$testName}' passed :)
\n"; //else // print "Test '{$testName}' FAILED !!! "; //print "
";
//print $result;
//print "
\n";