annotate core/modules/locale/tests/src/Unit/StringBaseTest.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Tests\locale\Unit;
Chris@0 4
Chris@0 5 use Drupal\locale\SourceString;
Chris@0 6 use Drupal\locale\StringStorageException;
Chris@0 7 use Drupal\Tests\UnitTestCase;
Chris@0 8
Chris@0 9 /**
Chris@0 10 * @coversDefaultClass \Drupal\locale\StringBase
Chris@0 11 * @group locale
Chris@0 12 */
Chris@0 13 class StringBaseTest extends UnitTestCase {
Chris@0 14
Chris@0 15 /**
Chris@0 16 * @covers ::save
Chris@0 17 */
Chris@0 18 public function testSaveWithoutStorage() {
Chris@0 19 $string = new SourceString(['source' => 'test']);
Chris@0 20 $this->setExpectedException(StringStorageException::class, 'The string cannot be saved because its not bound to a storage: test');
Chris@0 21 $string->save();
Chris@0 22 }
Chris@0 23
Chris@0 24 /**
Chris@0 25 * @covers ::delete
Chris@0 26 */
Chris@0 27 public function testDeleteWithoutStorage() {
Chris@0 28 $string = new SourceString(['lid' => 1, 'source' => 'test']);
Chris@0 29 $this->setExpectedException(StringStorageException::class, 'The string cannot be deleted because its not bound to a storage: test');
Chris@0 30 $string->delete();
Chris@0 31 }
Chris@0 32
Chris@0 33 }