StringBaseTest.php in Drupal 8
File
core/modules/locale/tests/src/Unit/StringBaseTest.php
View source
<?php
namespace Drupal\Tests\locale\Unit;
use Drupal\locale\SourceString;
use Drupal\locale\StringStorageException;
use Drupal\Tests\UnitTestCase;
class StringBaseTest extends UnitTestCase {
public function testSaveWithoutStorage() {
$string = new SourceString([
'source' => 'test',
]);
$this
->expectException(StringStorageException::class);
$this
->expectExceptionMessage('The string cannot be saved because its not bound to a storage: test');
$string
->save();
}
public function testDeleteWithoutStorage() {
$string = new SourceString([
'lid' => 1,
'source' => 'test',
]);
$this
->expectException(StringStorageException::class);
$this
->expectExceptionMessage('The string cannot be deleted because its not bound to a storage: test');
$string
->delete();
}
}