function StringBaseTest::testDeleteWithoutStorage

Same name in other branches
  1. 9 core/modules/locale/tests/src/Unit/StringBaseTest.php \Drupal\Tests\locale\Unit\StringBaseTest::testDeleteWithoutStorage()
  2. 8.9.x core/modules/locale/tests/src/Unit/StringBaseTest.php \Drupal\Tests\locale\Unit\StringBaseTest::testDeleteWithoutStorage()
  3. 11.x core/modules/locale/tests/src/Unit/StringBaseTest.php \Drupal\Tests\locale\Unit\StringBaseTest::testDeleteWithoutStorage()

@covers ::delete

File

core/modules/locale/tests/src/Unit/StringBaseTest.php, line 30

Class

StringBaseTest
@coversDefaultClass \Drupal\locale\StringBase @group locale

Namespace

Drupal\Tests\locale\Unit

Code

public function testDeleteWithoutStorage() : void {
    $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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.