Make charset-related tests more friendly to hhvm; stricter tests for demo files
authorgggeek <giunta.gaetano@gmail.com>
Tue, 14 Apr 2015 23:15:44 +0000 (00:15 +0100)
committergggeek <giunta.gaetano@gmail.com>
Tue, 14 Apr 2015 23:15:44 +0000 (00:15 +0100)
tests/1ParsingBugsTest.php
tests/3LocalhostTest.php
tests/5DemofilesTest.php
tests/LocalFileTestCase.php

index 28bb9d5..6a6a3f9 100644 (file)
@@ -451,7 +451,7 @@ and there they were.</value></member><member><name>postid</name><value>7414222</
         $v = $v['content'];
         $this->assertEquals($string, $v);
 
-        $f = '<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+        $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
 ';
         $r = $s->parseResponse($f, false, 'phpvals');
@@ -478,7 +478,7 @@ and there they were.</value></member><member><name>postid</name><value>7414222</
         $v = $v['content'];
         $this->assertEquals($string, $v);
 
-        $f = '<?xml version="1.0" encoding="iso-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
+        $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
 <member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse>
 ';
         $r = $s->parseResponse($f, false, 'phpvals');
index ea7c5bf..e73bf61 100644 (file)
@@ -167,7 +167,7 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
     {
         $sendstring =
             "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
-        $f = '<?xml version="1.0" encoding="iso-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
+        $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
             $sendstring.
             '</value></param></params></methodCall>';
         $v = $this->send($f);
index 63708fe..b7a3871 100644 (file)
@@ -54,7 +54,7 @@ class DemoFilesTest extends PhpXmlRpc_LocalFileTestCase
 
     public function testSimpleCall()
     {
-        $page = $this->request('client/simple_call.php');
+        $page = $this->request('client/simple_call.php', 'GET', null, true);
     }
 
     public function testWhich()
index 688e0df..59818c8 100644 (file)
@@ -41,7 +41,7 @@ abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
         return $result;
     }
 
-    protected function request($file, $method = 'GET', $payload = '')
+    protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false)
     {
         $url = $this->baseUrl . $file;
 
@@ -68,6 +68,9 @@ abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
         curl_close($ch);
 
         $this->assertNotFalse($page);
+        if (!$emptyPageOk) {
+            $this->assertNotEquals('', $page);
+        }
         $this->assertNotContains('Fatal error', $page);
         $this->assertNotContains('Notice:', $page);