Esempio n. 1
0
 public function asString()
 {
     $key = $this->timeAgo->getKey();
     $params = $this->timeAgo->getParams();
     if (Strings::equal($key, 'timeAgo.thisYear')) {
         $params['month'] = I18n::t($params['month']);
     }
     return I18n::t($key, $params);
 }
Esempio n. 2
0
 /**
  * @test
  * @dataProvider dates
  * @param string $currentDate
  * @param string $date
  * @param string $expectedKey
  * @param array $expectedParams
  */
 public function shouldCreateTimeAgo($currentDate, $date, $expectedKey, $expectedParams)
 {
     //given
     Clock::freeze($currentDate);
     //when
     $timeAgo = TimeAgo::create($date);
     //then
     $this->assertEquals($expectedKey, $timeAgo->getKey());
     $this->assertEquals($expectedParams, $timeAgo->getParams());
 }