function CrudTest::testTranslators in Translation Management Tool 8
Test crud operations of translators.
File
- tests/
src/ Kernel/ CrudTest.php, line 32
Class
- CrudTest
- Basic crud operations for jobs and translators
Namespace
Drupal\Tests\tmgmt\KernelCode
function testTranslators() {
$translator = $this
->createTranslator();
$loaded_translator = Translator::load($translator
->id());
$this
->assertEqual($translator
->id(), $loaded_translator
->id());
$this
->assertEqual($translator
->label(), $loaded_translator
->label());
$this
->assertEqual($translator
->getSettings(), $loaded_translator
->getSettings());
// Update the settings.
$translator
->setSetting('new_key', $this
->randomString());
$translator
->save();
$loaded_translator = Translator::load($translator
->id());
$this
->assertEqual($translator
->id(), $loaded_translator
->id());
$this
->assertEqual($translator
->label(), $loaded_translator
->label());
$this
->assertEqual($translator
->getSettings(), $loaded_translator
->getSettings());
// Delete the translator, make sure the translator is gone.
$translator
->delete();
$this
->assertNull(Translator::load($translator
->id()));
}