3 namespace Drupal\php\Tests;
6 * Tests to make sure access to the PHP filter is properly restricted.
10 class PhpAccessTest extends PhpTestBase {
13 * Makes sure that the user can't use the PHP filter when not given access.
15 public function testNoPrivileges() {
16 // Create node with PHP filter enabled.
19 'create page content',
20 'edit own page content',
22 $web_user = $this->drupalCreateUser($permissions);
23 $this->drupalLogin($web_user);
24 $node = $this->createNodeWithCode();
26 // Make sure that the PHP code shows up as text.
27 $this->drupalGet('node/' . $node->id());
28 $this->assertText('print', 'PHP code was not evaluated.');
30 // Make sure that user doesn't have access to filter.
31 $this->drupalGet('node/' . $node->id() . '/edit');
32 $this->assertNoRaw('<option value="' . $this->phpCodeFormat->id() . '">', 'PHP code format not available.');