5 * Definition of Drupal\php\Tests\PhpAccessTest.
8 namespace Drupal\php\Tests;
11 * Tests to make sure access to the PHP filter is properly restricted.
15 class PhpAccessTest extends PhpTestBase {
18 * Makes sure that the user can't use the PHP filter when not given access.
20 public function testNoPrivileges() {
21 // Create node with PHP filter enabled.
22 $web_user = $this->drupalCreateUser(['access content', 'create page content', 'edit own page content']);
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.');