/** * test the end option for timeAgoInWords * * @dataProvider timeAgoEndProvider * @return void */ public function testTimeAgoInWordsEndFrozenDate($input, $expected, $end) { $time = new FrozenDate($input); $result = $time->timeAgoInWords(['end' => $end]); $this->assertEquals($expected, $result); }
* Plugin::load('Migrations'); //Loads a single plugin named Migrations * */ Plugin::load('Migrations'); Plugin::load('Crud'); Plugin::load('ADmad/JwtAuth'); /** * Connect middleware/dispatcher filters. */ DispatcherFactory::add('Asset'); DispatcherFactory::add('Routing'); DispatcherFactory::add('NoExtensions'); DispatcherFactory::add('ControllerFactory'); /** * Enable immutable time objects in the ORM. * * You can enable default locale format parsing by adding calls * to `useLocaleParser()`. This enables the automatic conversion of * locale specific date formats. For details see * @link http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data */ Type::build('time')->useImmutable(); Type::build('date')->useImmutable(); Type::build('datetime')->useImmutable(); /** * More friendly formating of date/time in json output. */ use Cake\I18n\FrozenDate; use Cake\I18n\FrozenTime; FrozenDate::setJsonEncodeFormat('yyyy-MM-dd'); FrozenTime::setJsonEncodeFormat('yyyy-MM-dd HH:mm:ss');