mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-07 18:21:23 +02:00
API Substitute Zend_Locale with Locale / NumberFormatter API Substitute Zend_Date with IntlDateFormatter API Added DBTIme::Nice12, FormatFromSettings API Added Short() method to DBDate / DBTime / DBDatetime API Add Date::getTimestamp() API Added setSubmittedValue api for FormField API Add second arg to base FormField::setValue() API Major refactor of i18n into component data parts API Implement Resettable interface to reset objects between tests ENHANCEMENT Changed DBField::create_field return type to `static` to support better type hinting ENHANCEMENT i18nTextCollector supports __CLASS__
46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\ORM\Tests;
|
|
|
|
use SilverStripe\ORM\FieldType\DBField;
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\ORM\FieldType\DBLocale;
|
|
|
|
class DBLocaleTest extends SapphireTest
|
|
{
|
|
public function testNice()
|
|
{
|
|
/** @var DBLocale $locale */
|
|
$locale = DBField::create_field('Locale', 'de_DE');
|
|
$this->assertEquals('German', $locale->Nice());
|
|
}
|
|
|
|
public function testNiceNative()
|
|
{
|
|
/** @var DBLocale $locale */
|
|
$locale = DBField::create_field('Locale', 'de_DE');
|
|
$this->assertEquals('Deutsch', $locale->Nice(true));
|
|
}
|
|
|
|
public function testNativeName()
|
|
{
|
|
/** @var DBLocale $locale */
|
|
$locale = DBField::create_field('Locale', 'de_DE');
|
|
$this->assertEquals('Deutsch', $locale->getNativeName());
|
|
}
|
|
|
|
public function testShortName()
|
|
{
|
|
/** @var DBLocale $locale */
|
|
$locale = DBField::create_field('Locale', 'de_DE');
|
|
$this->assertEquals('German', $locale->getShortName());
|
|
}
|
|
|
|
public function testLongName()
|
|
{
|
|
/** @var DBLocale $locale */
|
|
$locale = DBField::create_field('Locale', 'de_DE');
|
|
$this->assertEquals('German (Germany)', $locale->getLongName());
|
|
}
|
|
}
|