PHPAccessTestCase::testNoPrivileges

7 php.test PHPAccessTestCase::testNoPrivileges()
8 php.test PHPAccessTestCase::testNoPrivileges()

Makes sure that the user can't use the PHP filter when not given access.

File

modules/php/php.test, line 106
Tests for php.module.

Code

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('<option value="' . $this->php_code_format->format . '">', t('PHP code format not available.'));
}
Login or register to post comments