function NodeTypeTest::testNodeTypeGetFunctions
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeTypeTest.php \Drupal\Tests\node\Functional\NodeTypeTest::testNodeTypeGetFunctions()
- 10 core/modules/node/tests/src/Functional/NodeTypeTest.php \Drupal\Tests\node\Functional\NodeTypeTest::testNodeTypeGetFunctions()
- 11.x core/modules/node/tests/src/Functional/NodeTypeTest.php \Drupal\Tests\node\Functional\NodeTypeTest::testNodeTypeGetFunctions()
Ensures that node type functions (node_type_get_*) work correctly.
Load available node types and validate the returned data.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeTypeTest.php, line 38
Class
- NodeTypeTest
- Ensures that node type functions work correctly.
Namespace
Drupal\Tests\node\FunctionalCode
public function testNodeTypeGetFunctions() {
$node_types = NodeType::loadMultiple();
$node_names = node_type_get_names();
$this->assertTrue(isset($node_types['article']), 'Node type article is available.');
$this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
$this->assertEqual($node_types['article']->label(), $node_names['article'], 'Correct node type base has been returned.');
$article = NodeType::load('article');
$this->assertEqual($node_types['article'], $article, 'Correct node type has been returned.');
$this->assertEqual($node_types['article']->label(), $article->label(), 'Correct node type name has been returned.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.