function LocaleProjectStorageTest::testDelete

Same name and namespace in other branches
  1. 11.x core/modules/locale/tests/src/Unit/LocaleProjectStorageTest.php \Drupal\Tests\locale\Unit\LocaleProjectStorageTest::testDelete()

Tests deleted projects are not included in the count.

File

core/modules/locale/tests/src/Unit/LocaleProjectStorageTest.php, line 92

Class

LocaleProjectStorageTest
@coversDefaultClass \Drupal\locale\LocaleProjectStorage[[api-linebreak]] @group locale @runTestsInSeparateProcesses

Namespace

Drupal\Tests\locale\Unit

Code

public function testDelete() : void {
  $this->projectStorage
    ->set('b', [
    'name' => 'b',
  ]);
  $this->assertSame([
    'name' => 'b',
  ], $this->projectStorage
    ->get('b'));
  $this->assertSame(1, $this->projectStorage
    ->countProjects());
  $this->projectStorage
    ->delete('b');
  $this->assertNull($this->projectStorage
    ->get('b'));
  $this->assertSame(0, $this->projectStorage
    ->countProjects());
}

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