setPreference('datef','d/m/Y', 0, 'global'); $current_user->save(); } public static function tearDownAfterClass() { SugarTestUserUtilities::removeAllCreatedAnonymousUsers(); } /** * testSchedulersJobHandleDateFormatWithNow * */ public function testSchedulersJobHandleDateFormatWithNow() { global $current_user; $job = new SchedulersJob(false); $job->user = $current_user; $this->assertRegExp('/^\d{4}\-\d{2}\-\d{2}\s\d{1,2}\:\d{2}\:\d{2}$/', $job->handleDateFormat('now')); $this->assertRegExp('/^\d{4}\-\d{2}\-\d{2}\s\d{1,2}\:\d{2}\:\d{2}$/', $job->handleDateFormat('now'), $current_user, false); $this->assertRegExp('/^\d{1,2}\/\d{1,2}\/\d{4}\s\d{1,2}\:\d{2}$/', $job->handleDateFormat('now', $current_user, true)); } /** * testSchedulersJobHandleDateFormatWithoutNow * */ public function testSchedulersJobHandleDateFormatWithoutNow() { global $current_user; $job = new SchedulersJob(false); $job->user = $current_user; $this->assertRegExp('/^\d{4}\-\d{2}\-\d{2}\s\d{1,2}\:\d{2}\:\d{2}$/', $job->handleDateFormat()); } /** * testSchedulersJobHandleDateFormatWithOtherTime * */ public function testSchedulersJobHandleDateFormatWithOtherTime() { global $current_user; $job = new SchedulersJob(false); $job->user = $current_user; $this->assertRegExp('/^\d{4}\-\d{2}\-\d{2}\s\d{1,2}\:\d{2}\:\d{2}$/', $job->handleDateFormat('+7 days')); $this->assertRegExp('/^\d{4}\-\d{2}\-\d{2}\s\d{1,2}\:\d{2}\:\d{2}$/', $job->handleDateFormat('+7 days', $current_user, false)); $this->assertRegExp('/^\d{1,2}\/\d{1,2}\/\d{4}\s\d{1,2}\:\d{2}$/', $job->handleDateFormat('+7 days', $current_user, true)); } }