diff options
Diffstat (limited to 'modules/php/php.test')
-rw-r--r-- | modules/php/php.test | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/modules/php/php.test b/modules/php/php.test index a70fb0ac6..778cb1052 100644 --- a/modules/php/php.test +++ b/modules/php/php.test @@ -14,14 +14,26 @@ class PHPTestCase extends DrupalWebTestCase { $admin_user = $this->drupalCreateUser(array('administer filters')); $this->drupalLogin($admin_user); - // Confirm that the PHP code text format was inserted as the newest format - // on the site. - $newest_format_id = db_query("SELECT MAX(format) FROM {filter_format}")->fetchField(); - $newest_format = filter_format_load($newest_format_id); - $this->assertEqual($newest_format->name, 'PHP code', t('PHP code text format was created.')); + // Verify that the PHP code text format was inserted. + $php_format_id = db_query_range('SELECT format FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'PHP code'))->fetchField(); + $php_format = filter_format_load($php_format_id); + $this->assertEqual($php_format->name, 'PHP code', t('PHP code text format was created.')); + + // Verify that the format has the PHP code filter enabled. + $filters = filter_list_format($php_format_id); + $this->assertTrue($filters['php_code']->status, t('PHP code filter is enabled.')); + + // Verify that the format exists on the administration page. + $this->drupalGet('admin/config/content/formats'); + $this->assertText('PHP code', t('PHP code text format was created.')); + + // Verify that anonymous and authenticated user roles do not have access. + $this->drupalGet('admin/config/content/formats/' . $php_format_id); + $this->assertFieldByName('roles[1]', FALSE, t('Anonymous users do not have access to PHP code format.')); + $this->assertFieldByName('roles[2]', FALSE, t('Authenticated users do not have access to PHP code format.')); // Store the format ID of the PHP code text format for later use. - $this->php_code_format = $newest_format_id; + $this->php_code_format = $php_format_id; } /** @@ -60,7 +72,7 @@ class PHPFilterTestCase extends PHPTestCase { // Make sure that the PHP code shows up as text. $this->drupalGet('node/' . $node->nid); - $this->assertText('print', t('PHP code is displayed.')); + $this->assertText('print', t('PHP code was not evaluated.')); // Change filter to PHP filter and see that PHP code is evaluated. $edit = array(); @@ -98,7 +110,7 @@ class PHPAccessTestCase extends PHPTestCase { // Make sure that the PHP code shows up as text. $this->drupalGet('node/' . $node->nid); - $this->assertText('print', t('PHP code is displayed.')); + $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'); |