function LocaleProjectStorageTest::testDelete

Same name and namespace in other branches
  1. 10 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 <a href="/api/drupal/core%21modules%21locale%21src%21LocaleProjectStorage.php/class/LocaleProjectStorage/11.x" title="Provides the locale project storage system using a key value store." class="local">\Drupal\locale\LocaleProjectStorage</a> @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.