Further modules included.
[yaffs-website] / web / modules / contrib / php / src / Tests / PhpAccessTest.php
1 <?php
2
3 /**
4  * @file
5  * Definition of Drupal\php\Tests\PhpAccessTest.
6  */
7
8 namespace Drupal\php\Tests;
9
10 /**
11  * Tests to make sure access to the PHP filter is properly restricted.
12  *
13  * @group PHP
14  */
15 class PhpAccessTest extends PhpTestBase {
16
17   /**
18    * Makes sure that the user can't use the PHP filter when not given access.
19    */
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();
25
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.');
29
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.');
33   }
34
35 }