function LocaleStringTest::testDeleteStrings
Tests that strings are correctly deleted.
File
-
core/
modules/ locale/ tests/ src/ Kernel/ LocaleStringTest.php, line 264
Class
- LocaleStringTest
- Tests the locale string storage, string objects and data API.
Namespace
Drupal\Tests\locale\KernelCode
public function testDeleteStrings() : void {
$source = $this->storage
->createString([
'source' => 'Revision ID',
])
->save();
$this->storage
->createTranslation([
'lid' => $source->lid,
'language' => 'fr',
'translation' => 'Translated Revision ID',
])
->save();
// Confirm that the string has been created.
$this->assertNotEmpty($this->storage
->findString([
'lid' => $source->lid,
]));
$this->storage
->deleteStrings([
'lid' => $source->lid,
]);
// Confirm that the string has been deleted.
$this->assertEmpty($this->storage
->findString([
'lid' => $source->lid,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.