2010-10-15 05:48:39 +02:00
|
|
|
<?php
|
2016-08-19 00:51:35 +02:00
|
|
|
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
|
|
use SilverStripe\Forms\DateField_View_JQuery;
|
|
|
|
|
2010-10-15 05:48:39 +02:00
|
|
|
/**
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2010-10-15 05:48:39 +02:00
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class DateFieldViewJQueryTest extends SapphireTest {
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function testConvert() {
|
2010-10-15 05:48:39 +02:00
|
|
|
$this->assertEquals(
|
|
|
|
'M d, yy',
|
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('MMM d, yyyy')
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2010-10-15 05:48:39 +02:00
|
|
|
$this->assertEquals(
|
|
|
|
'd/mm/yy',
|
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('d/MM/yyyy')
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2010-12-05 09:20:13 +01:00
|
|
|
$this->assertEquals(
|
|
|
|
'dd.m.yy',
|
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('dd.M.yyyy'),
|
|
|
|
'Month, no leading zero'
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2010-10-15 05:48:39 +02:00
|
|
|
$this->assertEquals(
|
|
|
|
'dd.mm.yy',
|
2010-12-05 09:20:13 +01:00
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('dd.MM.yyyy'),
|
|
|
|
'Month, two digit'
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2010-12-05 09:20:13 +01:00
|
|
|
$this->assertEquals(
|
|
|
|
'dd.M.yy',
|
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('dd.MMM.yyyy'),
|
|
|
|
'Abbreviated month name'
|
|
|
|
);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2010-12-05 09:20:13 +01:00
|
|
|
$this->assertEquals(
|
|
|
|
'dd.MM.yy',
|
|
|
|
DateField_View_JQuery::convert_iso_to_jquery_format('dd.MMMM.yyyy'),
|
|
|
|
'Full month name'
|
2010-10-15 05:48:39 +02:00
|
|
|
);
|
|
|
|
}
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|