mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix tests
This commit is contained in:
parent
7b7b3810e6
commit
2ae8fde2d3
@ -81,29 +81,29 @@ class i18nTest extends SapphireTest
|
||||
$provider = Injector::inst()->get(MessageProvider::class);
|
||||
$provider->getTranslator()->addResource(
|
||||
'array',
|
||||
[ 'i18nTest_DataObject.MyProperty' => 'MyProperty' ],
|
||||
[ i18nTest\TestDataObject::class.'.MyProperty' => 'MyProperty' ],
|
||||
'en_US'
|
||||
);
|
||||
$provider->getTranslator()->addResource(
|
||||
'array',
|
||||
[ 'i18nTest_DataObject.MyProperty' => 'Mein Attribut' ],
|
||||
[ i18nTest\TestDataObject::class.'.MyProperty' => 'Mein Attribut' ],
|
||||
'de_DE'
|
||||
);
|
||||
$provider->getTranslator()->addResource(
|
||||
'array',
|
||||
[ 'i18nTest_DataObject.MyUntranslatedProperty' => 'Mein Attribut' ],
|
||||
[ i18nTest\TestDataObject::class.'.MyUntranslatedProperty' => 'Mein Attribut' ],
|
||||
'en_US'
|
||||
);
|
||||
|
||||
// Test field labels
|
||||
$obj = new i18nTest\TestDataObject();
|
||||
$this->assertEquals(
|
||||
$obj->fieldLabel('MyProperty'),
|
||||
'Mein Attribut'
|
||||
'Mein Attribut',
|
||||
$obj->fieldLabel('MyProperty')
|
||||
);
|
||||
$this->assertEquals(
|
||||
$obj->fieldLabel('MyUntranslatedProperty'),
|
||||
'My Untranslated Property'
|
||||
'My Untranslated Property',
|
||||
$obj->fieldLabel('MyUntranslatedProperty')
|
||||
);
|
||||
}
|
||||
|
||||
@ -113,12 +113,12 @@ class i18nTest extends SapphireTest
|
||||
$provider = Injector::inst()->get(MessageProvider::class);
|
||||
$provider->getTranslator()->addResource(
|
||||
'array',
|
||||
[ 'i18nTest_Object.MyProperty' => 'Untranslated' ],
|
||||
[ i18nTest\TestObject::class.'.MyProperty' => 'Untranslated' ],
|
||||
'en_US'
|
||||
);
|
||||
$provider->getTranslator()->addResource(
|
||||
'array',
|
||||
[ 'i18nTest_Object.my_translatable_property' => 'Übersetzt' ],
|
||||
[ i18nTest\TestObject::class.'.my_translatable_property' => 'Übersetzt' ],
|
||||
'de_DE'
|
||||
);
|
||||
|
||||
|
@ -34,7 +34,7 @@ class TestDataObject extends DataObject implements TestOnly
|
||||
public function fieldLabels($includerelations = true)
|
||||
{
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['MyProperty'] = _t('SilverStripe\\i18n\\Tests\\i18Test\\TestDataObject.MyProperty', 'My Property');
|
||||
$labels['MyProperty'] = _t(__CLASS__.'.MyProperty', 'My Property');
|
||||
|
||||
return $labels;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ class TestObject implements TestOnly, i18nEntityProvider
|
||||
|
||||
public static function my_translatable_property()
|
||||
{
|
||||
return _t("SilverStripe\\i18n\\Tests\\i18Test\\TestObject.my_translatable_property", self::$my_translatable_property);
|
||||
return _t(__CLASS__.".my_translatable_property", self::$my_translatable_property);
|
||||
}
|
||||
|
||||
public function provideI18nEntities()
|
||||
{
|
||||
return [
|
||||
"i18nTest_Object.my_translatable_property" => self::$my_translatable_property,
|
||||
__CLASS__.".my_translatable_property" => self::$my_translatable_property,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user