Пример #1
0
 /**
  * Testing toString
  *
  * @param   string  $format        How should the time be formatted?
  * @param   string  $expectedTime  What should the resulting time string look like?
  *
  * @return  void
  *
  * @dataProvider casesToString
  * @since   11.3
  * @covers  JDate::__toString
  */
 public function testToString($format, $expectedTime)
 {
     if (!is_null($format)) {
         JDate::$format = $format;
     }
     $this->assertThat($this->object->__toString(), $this->equalTo($expectedTime));
 }
Пример #2
0
 /**
  * Set a data that is going to be stored and save it.
  *
  * <code>
  * $title = "My title...";
  * $type  = "MY_TYPE";
  * $data  = array(
  *     "amount" => 100,
  *     "currency" => "USD"
  * );
  *
  * $file   = "/logs/com_crowdfunding.log";
  * $writer = new PrismLogWriterFile($file);
  *
  * $log   = new PrismLog();
  * $log->addWriter($writer);
  *
  * $log->add($title, $type, $data);
  * </code>
  *
  * @param string $title
  * @param string $type
  * @param mixed  $data
  */
 public function add($title, $type, $data = null)
 {
     $this->setTitle($title);
     $this->setType($type);
     $this->setData($data);
     $date = new \JDate();
     $this->setRecordDate($date->__toString());
     $this->store();
 }