public function PhpTestBase::createNodeWithCode in PHP 8
Creates a test node with PHP code in the body.
Return value
\Drupal\node\NodeInterface Node object.
2 calls to PhpTestBase::createNodeWithCode()
- PhpAccessTest::testNoPrivileges in src/
Tests/ Functional/ PhpAccessTest.php - Makes sure that the user can't use the PHP filter when not given access.
- PhpFilterTest::testPhpFilter in src/
Tests/ Functional/ PhpFilterTest.php - Makes sure that the PHP filter evaluates PHP code when used.
File
- src/
Tests/ Functional/ PhpTestBase.php, line 63
Class
- PhpTestBase
- Test if PHP filter works in general.
Namespace
Drupal\Tests\php\FunctionalCode
public function createNodeWithCode() {
return $this
->drupalCreateNode([
'body' => [
[
'value' => '<?php print "SimpleTest PHP was executed!";print "Current state is " . Drupal::state()->get("php_state_test", "empty"); ?>',
],
],
]);
}