class StringBaseTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/locale/tests/src/Unit/StringBaseTest.php \Drupal\Tests\locale\Unit\StringBaseTest
- 9 core/modules/locale/tests/src/Unit/StringBaseTest.php \Drupal\Tests\locale\Unit\StringBaseTest
@coversDefaultClass \Drupal\locale\StringBase @group locale
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, PhpUnitWarnings
- class \Drupal\Tests\locale\Unit\StringBaseTest
Expanded class hierarchy of StringBaseTest
File
- core/
modules/ locale/ tests/ src/ Unit/ StringBaseTest.php, line 13
Namespace
Drupal\Tests\locale\UnitView source
class StringBaseTest extends UnitTestCase {
/**
* @covers ::save
*/
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();
}
/**
* @covers ::delete
*/
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();
}
}