當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Date::yesterday方法代碼示例

本文整理匯總了PHP中Piwik\Date::yesterday方法的典型用法代碼示例。如果您正苦於以下問題:PHP Date::yesterday方法的具體用法?PHP Date::yesterday怎麽用?PHP Date::yesterday使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Date的用法示例。


在下文中一共展示了Date::yesterday方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDayIsFinishedYesterday

 /**
  * yesterday 23:59:59 is finished
  * @group Core
  */
 public function testDayIsFinishedYesterday()
 {
     $period = new Day(Date::yesterday());
     $this->assertEquals(date("Y-m-d", time() - 86400), $period->toString());
     $this->assertEquals(array(), $period->getSubperiods());
     $this->assertEquals(0, $period->getNumberOfSubperiods());
 }
開發者ID:diosmosis,項目名稱:piwik,代碼行數:11,代碼來源:DayTest.php

示例2: testRangePrevious3days

 public function testRangePrevious3days()
 {
     $range = new Range('day', 'previous3');
     $yesterday = Date::yesterday();
     $correct = array();
     for ($i = 0; $i < 3; $i++) {
         $correct[] = $yesterday->subDay($i)->toString();
     }
     $correct = array_reverse($correct);
     $this->assertEquals(3, $range->getNumberOfSubperiods());
     $this->assertEquals($correct, $range->toString());
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:12,代碼來源:RangeTest.php

示例3: testYesterday

 /**
  * create today object check that timestamp is correct (midnight)
  *
  * @group Core
  */
 public function testYesterday()
 {
     $date = Date::yesterday();
     $this->assertEquals(strtotime(date("Y-m-d", strtotime('-1day')) . " 00:00:00"), $date->getTimestamp());
 }
開發者ID:ahdinosaur,項目名稱:analytics.dinosaur.is,代碼行數:10,代碼來源:DateTest.php

示例4: testCheckOtherTestsWereComplete

            $apiForTesting[] = array('VisitsSummary.get', array('idSite' => self::$fixture->idSite, 'date' => date("Y-m-d", strtotime(self::$fixture->dateTime)) . ',today', 'period' => 'range', 'testSuffix' => '_' . $segment['segment'], 'segmentToComplete' => $segment['segment']));
        }
        return $apiForTesting;
    }
    /**
     * @depends      testAnotherApi
     */
    public function testCheckOtherTestsWereComplete()
    {
        // Check that only a few haven't been tested specifically (these are all custom variables slots since we only test slot 1, 2, 5 (see the fixture) and example dimension slots)
        $maximumSegmentsToSkip = 16;
        $this->assertLessThan($maximumSegmentsToSkip, count(self::$skipped), 'SKIPPED ' . count(self::$skipped) . ' segments --> some segments had no "auto-suggested values"
            but we should try and test the autosuggest for all new segments. Segments skipped were: ' . implode(', ', self::$skipped));
        // and check that most others have been tested
        $minimumSegmentsToTest = 46;
        $message = 'PROCESSED ' . self::$processed . ' segments --> it seems some segments "auto-suggested values" haven\'t been tested as we were expecting. ';
        $this->assertGreaterThan($minimumSegmentsToTest, self::$processed, $message);
    }
    public static function getSegmentsMetadata($idSite)
    {
        // Refresh cache for CustomVariables\Model
        Cache::clearCacheGeneral();
        \Piwik\Plugins\CustomVariables\Model::install();
        // Segment matching NONE
        $segments = \Piwik\Plugins\API\API::getInstance()->getSegmentsMetadata($idSite);
        return $segments;
    }
}
AutoSuggestAPITest::$fixture = new ManyVisitsWithGeoIP();
AutoSuggestAPITest::$fixture->dateTime = Date::yesterday()->subDay(30)->getDatetime();
開發者ID:ahdinosaur,項目名稱:analytics.dinosaur.is,代碼行數:30,代碼來源:AutoSuggestAPITest.php

示例5: getAnotherApiForTesting

    public function getAnotherApiForTesting()
    {
        $apiForTesting = array();
        $segments = \Piwik\Plugins\API\API::getInstance()->getSegmentsMetadata(self::$fixture->idSite);
        foreach ($segments as $segment) {
            if (self::isTravisCI() && $segment['segment'] == 'deviceType') {
                // test started failing after bc19503 and I cannot understand why
                continue;
            }
            $apiForTesting[] = array('VisitsSummary.get', array('idSite' => self::$fixture->idSite, 'date' => date("Y-m-d", strtotime(self::$fixture->dateTime)) . ',today', 'period' => 'range', 'testSuffix' => '_' . $segment['segment'], 'segmentToComplete' => $segment['segment']));
        }
        return $apiForTesting;
    }
    /**
     * @group Integration
     * @depends      testAnotherApi
     */
    public function testCheckOtherTestsWereComplete()
    {
        // Check that only a few haven't been tested specifically (these are all custom variables slots since we only test slot 1, 2, 5 (see the fixture))
        $maximumSegmentsToSkip = 11;
        $this->assertTrue(count(self::$skipped) <= $maximumSegmentsToSkip, 'SKIPPED ' . count(self::$skipped) . ' segments --> some segments had no "auto-suggested values"
            but we should try and test the autosuggest for all new segments. Segments skipped were: ' . implode(', ', self::$skipped));
        // and check that most others have been tested
        $minimumSegmentsToTest = 46;
        $this->assertTrue(self::$processed >= $minimumSegmentsToTest, 'PROCESSED ' . self::$processed . ' segments --> it seems some segments "auto-suggested values" haven\'t been tested as we were expecting');
    }
}
Test_Piwik_Integration_AutoSuggestAPITest::$fixture = new Test_Piwik_Fixture_ManyVisitsWithGeoIP();
Test_Piwik_Integration_AutoSuggestAPITest::$fixture->dateTime = Date::yesterday()->subDay(30)->getDatetime();
開發者ID:carriercomm,項目名稱:piwik,代碼行數:30,代碼來源:AutoSuggestAPITest.php


注:本文中的Piwik\Date::yesterday方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。