コード例 #1
0
 public function testPiwikPhp()
 {
     if (IntegrationTestCase::isMysqli()) {
         $this->markTestSkipped('Sometimes fails with 500 error');
     }
     $curlHandle = curl_init();
     $url = $this->getStaticSrvUrl() . '/js/?idsite=1';
     curl_setopt($curlHandle, CURLOPT_URL, $url);
     curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
     $fullResponse = curl_exec($curlHandle);
     $responseInfo = curl_getinfo($curlHandle);
     curl_close($curlHandle);
     $this->assertEquals(200, $responseInfo["http_code"], var_export($responseInfo, true));
     $expected = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
     $processed = base64_encode($fullResponse);
     if ($expected != $processed) {
         $this->markTestSkipped("testPiwikPhp invalid response content: " . $fullResponse);
     }
     $this->assertEquals($expected, $processed, 'checking for image content' . "\n\n\n\nRaw content: \n\n\n" . $fullResponse);
 }