function UninstallDefaultContentTest::assertRecipesImported

Same name in other branches
  1. 9 core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertRecipesImported()
  2. 8.9.x core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertRecipesImported()
  3. 11.x core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertRecipesImported()

Assert recipes are imported.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $node_storage: Node storage.

1 call to UninstallDefaultContentTest::assertRecipesImported()
UninstallDefaultContentTest::testReinstall in core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php
Tests uninstalling content removes created entities.

File

core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php, line 90

Class

UninstallDefaultContentTest
Tests that uninstalling default content removes created content.

Namespace

Drupal\Tests\demo_umami_content\Functional

Code

protected function assertRecipesImported(EntityStorageInterface $node_storage) : void {
    $count = $node_storage->getQuery()
        ->accessCheck(FALSE)
        ->condition('type', 'recipe')
        ->count()
        ->execute();
    $this->assertGreaterThan(0, $count);
    $nodes = $node_storage->loadByProperties([
        'title' => 'Gluten free pizza',
    ]);
    $this->assertCount(1, $nodes);
    $node = reset($nodes);
    $this->assertStringContainsString('Mix some of the milk and water in a jug', $node->field_recipe_instruction->value);
}

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