当前位置: 首页>>代码示例>>PHP>>正文


PHP Fixture::getRootUrl方法代码示例

本文整理汇总了PHP中Piwik\Tests\Framework\Fixture::getRootUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Fixture::getRootUrl方法的具体用法?PHP Fixture::getRootUrl怎么用?PHP Fixture::getRootUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Tests\Framework\Fixture的用法示例。


在下文中一共展示了Fixture::getRootUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testWebArchiving

 public function testWebArchiving()
 {
     if (self::isMysqli() && self::isTravisCI()) {
         $this->markTestSkipped('Skipping on Mysqli as it randomly fails.');
     }
     $host = Fixture::getRootUrl();
     $token = Fixture::getTokenAuth();
     $urlTmp = Option::get('piwikUrl');
     Option::set('piwikUrl', $host . 'tests/PHPUnit/proxy/index.php');
     $url = $host . 'tests/PHPUnit/proxy/archive.php?token_auth=' . $token;
     $output = Http::sendHttpRequest($url, 600);
     // ignore random build issues
     if (empty($output) || strpos($output, \Piwik\CronArchive::NO_ERROR) === false) {
         $message = "This test has failed. Because it sometimes randomly fails, we skip the test, and ignore this failure.\n";
         $message .= "If you see this message often, or in every build, please investigate as this should only be a random and rare occurence!\n";
         $message .= "\n\narchive web failed: " . $output . "\n\nurl used: {$url}";
         $this->markTestSkipped($message);
     }
     if (!empty($urlTmp)) {
         Option::set('piwikUrl', $urlTmp);
     } else {
         Option::delete('piwikUrl');
     }
     $this->assertContains('Starting Piwik reports archiving...', $output);
     $this->assertContains('Archived website id = 1', $output);
     $this->assertContains('Done archiving!', $output);
     $this->compareArchivePhpOutputAgainstExpected($output);
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:28,代码来源:ArchiveWebTest.php

示例2: checkPiwikSetupForTests

function checkPiwikSetupForTests()
{
    if (empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '@REQUEST_URI@') {
        echo "WARNING: for tests to pass, you must first:\n1) Install webserver on localhost, eg. apache\n2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/\n3) Install Piwik by going through the installation process\n4) Copy phpunit.xml.dist to phpunit.xml\n5) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'\n\nTry again.\n-> If you still get this message, you can work around it by specifying Host + Request_Uri at the top of this file tests/PHPUnit/bootstrap.php. <-";
        exit(1);
    }
    $baseUrl = \Piwik\Tests\Framework\Fixture::getRootUrl();
    \Piwik\SettingsPiwik::checkPiwikServerWorking($baseUrl, $acceptInvalidSSLCertificates = true);
}
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:9,代码来源:bootstrap.php

示例3: test_setSegmentsToForceFromSegmentIds_CorrectlyGetsSegmentDefinitions_FromSegmentIds

 public function test_setSegmentsToForceFromSegmentIds_CorrectlyGetsSegmentDefinitions_FromSegmentIds()
 {
     Fixture::createWebsite('2014-12-12 00:01:02');
     SegmentAPI::getInstance()->add('foo', 'actions>=1', 1, true, true);
     SegmentAPI::getInstance()->add('barb', 'actions>=2', 1, true, true);
     SegmentAPI::getInstance()->add('burb', 'actions>=3', 1, true, true);
     SegmentAPI::getInstance()->add('sub', 'actions>=4', 1, true, true);
     $cronarchive = new TestCronArchive(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php');
     $cronarchive->setSegmentsToForceFromSegmentIds(array(2, 4));
     $expectedSegments = array('actions>=2', 'actions>=4');
     $this->assertEquals($expectedSegments, array_values($cronarchive->segmentsToForce));
 }
开发者ID:hichnik,项目名称:piwik,代码行数:12,代码来源:CronArchiveTest.php

示例4: testHEADOperation

 /**
  * @group Core
  *
  * @dataProvider getMethodsToTest
  */
 public function testHEADOperation($method)
 {
     if ($method == 'fopen') {
         return;
         // not supported w/ this method
     }
     $result = Http::sendHttpRequestBy($method, Fixture::getRootUrl() . 'tests/PHPUnit/Integration/Http/fixture.zip', 30, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $acceptInvalidSslCertificate = false, $byteRange = false, $getExtendedInfo = true, $httpMethod = 'HEAD');
     $this->assertEquals('', $result['data']);
     $this->assertEquals(200, $result['status']);
     $this->assertTrue(isset($result['headers']['Content-Length']), "Content-Length header not set!");
     $this->assertTrue(is_numeric($result['headers']['Content-Length']), "Content-Length header not numeric!");
     $this->assertEquals('application/zip', $result['headers']['Content-Type']);
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:18,代码来源:HttpTest.php

示例5: getResponseHeader

 private function getResponseHeader($url)
 {
     if (!function_exists('curl_init')) {
         $this->markTestSkipped('Curl is not installed');
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, Fixture::getRootUrl() . 'tests/PHPUnit/proxy/' . $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     $response = curl_exec($ch);
     $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
     $header = substr($response, 0, $headerSize);
     curl_close($ch);
     return $header;
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:16,代码来源:FrontControllerTest.php

示例6: issueBulkTrackingRequest

 protected function issueBulkTrackingRequest($token_auth, $expectTrackingToSucceed)
 {
     $piwikHost = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php';
     $command = 'curl -s -X POST -d \'{"requests":["?idsite=1&url=http://example.org&action_name=Test bulk log Pageview&rec=1","?idsite=1&url=http://example.net/test.htm&action_name=Another bulk page view&rec=1"],"token_auth":"' . $token_auth . '"}\' ' . $piwikHost;
     exec($command, $output, $result);
     if ($result !== 0) {
         throw new Exception("tracking bulk failed: " . implode("\n", $output) . "\n\ncommand used: {$command}");
     }
     $output = implode("", $output);
     $this->assertStringStartsWith('{"status":', $output);
     if ($expectTrackingToSucceed) {
         $this->assertNotContains('error', $output);
         $this->assertContains('success', $output);
     } else {
         $this->assertContains('error', $output);
         $this->assertNotContains('success', $output);
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:18,代码来源:TrackerTest.php

示例7: test_WebArchiving

 public function test_WebArchiving()
 {
     if (self::isMysqli() && self::isTravisCI()) {
         $this->markTestSkipped('Skipping on Mysqli as it randomly fails.');
     }
     $host = Fixture::getRootUrl();
     $token = Fixture::getTokenAuth();
     $urlTmp = Option::get('piwikUrl');
     Option::set('piwikUrl', $host . 'tests/PHPUnit/proxy/index.php');
     $url = $host . 'tests/PHPUnit/proxy/archive.php?token_auth=' . $token;
     $output = Http::sendHttpRequest($url, 600);
     // ignore random build issues
     if (empty($output) || strpos($output, \Piwik\CronArchive::NO_ERROR) === false) {
         $this->fail("archive web failed: " . $output . "\n\nurl used: {$url}");
     }
     if (!empty($urlTmp)) {
         Option::set('piwikUrl', $urlTmp);
     } else {
         Option::delete('piwikUrl');
     }
     $this->assertWebArchivingDone($output);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:22,代码来源:ArchiveWebTest.php

示例8: sendArchiveWebRequest

 private function sendArchiveWebRequest()
 {
     return $this->curl(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/archive.php?token_auth=' . Fixture::getTokenAuth());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:4,代码来源:EnvironmentValidationTest.php

示例9: runArchivePhpCron

 private function runArchivePhpCron($options = array(), $archivePhpScript = false)
 {
     $archivePhpScript = $archivePhpScript ?: PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php';
     $urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php';
     // create the command
     $cmd = "php \"{$archivePhpScript}\" --url=\"{$urlToProxy}\"";
     foreach ($options as $name => $value) {
         $cmd .= " {$name}";
         if ($value !== null) {
             $cmd .= "=" . escapeshellarg($value);
         }
     }
     $cmd .= " 2>&1";
     // run the command
     exec($cmd, $output, $result);
     if ($result !== 0 || stripos($result, "error")) {
         $this->fail("archive cron failed: " . implode("\n", $output) . "\n\ncommand used: {$cmd}");
     }
     return $output;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:20,代码来源:ArchiveCronTest.php

示例10: getUrl

 private function getUrl()
 {
     return Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php?module=API&method=API.getPiwikVersion';
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:4,代码来源:APITest.php

示例11: writeJsConfig

    /**
     * We override the default values of tests/UI/config.dist.js with config
     * values from the local INI config.
     */
    private function writeJsConfig()
    {
        $localConfigFile = PIWIK_INCLUDE_PATH . '/tests/UI/config.js';
        $tag = 'File generated by the tests:run-ui command';
        // If the file wasn't generated by this command, we don't ovewrite it
        if (file_exists($localConfigFile)) {
            $fileContent = file_get_contents($localConfigFile);
            if (strpos($fileContent, $tag) === false) {
                return;
            }
        }
        $url = Fixture::getRootUrl();
        $host = Config::getInstance()->tests['http_host'];
        $uri = Config::getInstance()->tests['request_uri'];
        $js = <<<JS
/**
 * {$tag}
 */
exports.piwikUrl = "{$url}";
exports.phpServer = {
    HTTP_HOST: '{$host}',
    REQUEST_URI: '{$uri}',
    REMOTE_ADDR: '127.0.0.1'
};
JS;
        file_put_contents(PIWIK_INCLUDE_PATH . '/tests/UI/config.js', $js);
    }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:31,代码来源:TestsRunUI.php

示例12: testHttpPost_ViaArray

 /**
  * @dataProvider getMethodsToTest
  */
 public function testHttpPost_ViaArray($method)
 {
     $result = Http::sendHttpRequestBy($method, Fixture::getRootUrl() . 'tests/PHPUnit/Integration/Http/Post.php', 30, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $acceptInvalidSslCertificate = false, $byteRange = false, $getExtendedInfo = false, $httpMethod = 'POST', $httpUsername = '', $httpPassword = '', array('adf2' => '44', 'afc23' => 'ab12'));
     $this->assertEquals('{"adf2":"44","afc23":"ab12","method":"post"}', $result);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:8,代码来源:HttpTest.php

示例13: completeUrl

 private function completeUrl($query)
 {
     $host = Fixture::getRootUrl();
     if (false === strpos($query, '?')) {
         $query .= '?';
     } else {
         $query .= '&';
     }
     return $host . 'tests/PHPUnit/proxy/index.php' . $query . 'testmode=1&token_auth=' . $this->authToken;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:10,代码来源:CliMultiTest.php

示例14: getOwnPiwikTarget

 private function getOwnPiwikTarget()
 {
     return $this->getCustomPiwikTarget(Fixture::getRootUrl() . 'tests/PHPUnit/proxy/piwik.php', $this->idSite);
 }
开发者ID:andrzejewsky,项目名称:plugin-AnonymousPiwikUsageMeasurement,代码行数:4,代码来源:TargetsTest.php

示例15: runArchivePhpCron

 private function runArchivePhpCron()
 {
     $archivePhpScript = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php';
     $urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php';
     // create the command
     $cmd = "php \"{$archivePhpScript}\" --url=\"{$urlToProxy}\" 2>&1";
     // run the command
     exec($cmd, $output, $result);
     if ($result !== 0 || stripos($result, "error")) {
         $message = 'This failed once after a lunar eclipse, and it has again randomly failed.';
         $message .= "\n\narchive cron failed: " . implode("\n", $output) . "\n\ncommand used: {$cmd}";
         $this->markTestSkipped($message);
     }
     return $output;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:15,代码来源:ArchiveCronTest.php


注:本文中的Piwik\Tests\Framework\Fixture::getRootUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。