function UninstallDefaultContentTest::assertArticlesImported
Same name in other branches
- 9 core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertArticlesImported()
- 8.9.x core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertArticlesImported()
- 10 core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php \Drupal\Tests\demo_umami_content\Functional\UninstallDefaultContentTest::assertArticlesImported()
Assert articles are imported.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $node_storage: Node storage.
1 call to UninstallDefaultContentTest::assertArticlesImported()
- 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 110
Class
- UninstallDefaultContentTest
- Tests that uninstalling default content removes created content.
Namespace
Drupal\Tests\demo_umami_content\FunctionalCode
protected function assertArticlesImported(EntityStorageInterface $node_storage) : void {
$count = $node_storage->getQuery()
->accessCheck(FALSE)
->condition('type', 'article')
->count()
->execute();
$this->assertGreaterThan(0, $count);
$nodes = $node_storage->loadByProperties([
'title' => 'The umami guide to our favorite mushrooms',
]);
$this->assertCount(1, $nodes);
$node = reset($nodes);
$this->assertStringContainsString('One of the best things about mushrooms is their versatility', $node->get('field_body')->value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.