コード例 #1
0
 /**
  * Returns the point in time when the response's entity was last modified, according to the value of the
  * "Last-Modified" HTTP header.
  *
  * This method can be called for HTTP requests only.
  *
  * @return CTime The point in time when the response's entity was last modified, according to the value of the
  * "Last-Modified" HTTP header.
  */
 public function responseModificationTime()
 {
     assert('$this->isHttp() && $this->m_done && !$this->m_hasError', vs(isset($this), get_defined_vars()));
     assert('$this->responseHasModificationTime()', vs(isset($this), get_defined_vars()));
     $modificationTime = $this->responseHeader(CHttpResponse::LAST_MODIFIED);
     return CTime::fromString($modificationTime);
 }
コード例 #2
0
ファイル: CTimeTest.php プロジェクト: nunodotferreira/Phred
 public function testWithYearInTimeZone()
 {
     $time = CTime::fromString("2009-02-13 23:31:30 Europe/Helsinki");
     $time = $time->withYearInTimeZone(new CTimeZone("Europe/Helsinki"), 1930);
     $this->assertTrue($time->toStringInTimeZone(new CTimeZone("Europe/Helsinki"), CTime::PATTERN_MYSQL)->equals("1930-02-13 23:31:30"));
 }
コード例 #3
0
 public function testOrderDesc()
 {
     $this->assertTrue(CComparator::orderDesc(u("Hello there!"), u("Hello there!")) == 0);
     $this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0);
     $this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0);
     $this->assertTrue(CComparator::orderDesc(u("¡Hola señor!"), u("¡Hola señor!")) == 0);
     $this->assertTrue(CComparator::orderDesc(u("A"), u("B")) > 0);
     $this->assertTrue(CComparator::orderDesc(u("C"), u("B")) < 0);
     $this->assertTrue(CComparator::orderDesc(a("a", "b", "c"), a("a", "b", "c")) == 0);
     $this->assertTrue(CComparator::orderDesc(a("b", "b", "c"), a("a", "b", "c")) < 0);
     $this->assertTrue(CComparator::orderDesc(m(["one" => "a", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) == 0);
     $this->assertTrue(CComparator::orderDesc(m(["one" => "b", "two" => "b", "three" => "c"]), m(["one" => "a", "two" => "b", "three" => "c"])) < 0);
     $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1955 12:00:00 PST")) == 0);
     $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1955 12:00:00 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) > 0);
     $this->assertTrue(CComparator::orderDesc(CTime::fromString("11/5/1985 12:00:01 PST"), CTime::fromString("11/5/1985 12:00:00 PST")) < 0);
     $this->assertTrue(CComparator::orderDesc(true, true) == 0);
     $this->assertTrue(CComparator::orderDesc(false, true) > 0);
     $this->assertTrue(CComparator::orderDesc(true, false) < 0);
     $this->assertTrue(CComparator::orderDesc(1234, 1234) == 0);
     $this->assertTrue(CComparator::orderDesc(1234, 5678) > 0);
     $this->assertTrue(CComparator::orderDesc(5678, 1234) < 0);
     $this->assertTrue(CComparator::orderDesc(12.34, 12.34) == 0);
     $this->assertTrue(CComparator::orderDesc(12.34, 56.78) > 0);
     $this->assertTrue(CComparator::orderDesc(56.78, 12.34) < 0);
     $this->assertTrue(CComparator::orderDesc(null, null) == 0);
     $this->assertTrue(CComparator::orderDesc("Hello there!", "Hello there!") == 0);
     $this->assertTrue(CComparator::orderDesc("A", "B") > 0);
     $this->assertTrue(CComparator::orderDesc("C", "B") < 0);
     $this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("a", "b", "c")) == 0);
     $this->assertTrue(CComparator::orderDesc(CArray::fromElements("a", "b", "c"), CArray::fromElements("b", "b", "c")) > 0);
     $this->assertTrue(CComparator::orderDesc(CArray::fromElements("b", "b", "c"), CArray::fromElements("a", "b", "c")) < 0);
     $this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) == 0);
     $this->assertTrue(CComparator::orderDesc(["one" => "a", "two" => "b", "three" => "c"], ["one" => "b", "two" => "b", "three" => "c"]) > 0);
     $this->assertTrue(CComparator::orderDesc(["one" => "b", "two" => "b", "three" => "c"], ["one" => "a", "two" => "b", "three" => "c"]) < 0);
 }