diff --git a/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php b/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ec7f740d392a25c1381f1c08863b5066ca2e57ba --- /dev/null +++ b/core/modules/php/lib/Drupal/php/Tests/PhpAccessTest.php @@ -0,0 +1,39 @@ + 'PHP filter access check', + 'description' => 'Make sure that users who don\'t have access to the PHP filter can\'t see it.', + 'group' => 'PHP', + ); + } + + /** + * Makes sure that the user can't use the PHP filter when not given access. + */ + function testNoPrivileges() { + // Create node with PHP filter enabled. + $web_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content')); + $this->drupalLogin($web_user); + $node = $this->createNodeWithCode(); + + // Make sure that the PHP code shows up as text. + $this->drupalGet('node/' . $node->nid); + $this->assertText('print', t('PHP code was not evaluated.')); + + // Make sure that user doesn't have access to filter. + $this->drupalGet('node/' . $node->nid . '/edit'); + $this->assertNoRaw('