summaryrefslogtreecommitdiff
path: root/modules/php/php.test
diff options
context:
space:
mode:
Diffstat (limited to 'modules/php/php.test')
-rw-r--r--modules/php/php.test18
1 files changed, 6 insertions, 12 deletions
diff --git a/modules/php/php.test b/modules/php/php.test
index 487c5a5d6..bf1ea6a24 100644
--- a/modules/php/php.test
+++ b/modules/php/php.test
@@ -20,16 +20,10 @@ class PHPTestCase extends DrupalWebTestCase {
/**
* Create a test node with PHP code in the body.
*
- * @param stdObject User object to create node for.
* @return stdObject Node object.
*/
- function createNodeWithCode($user) {
- $node = $this->drupalCreateNode(array('uid' => $user->uid));
- $edit = array();
- $edit['body'] = '<?php print "SimpleTest PHP was executed!"; ?>';
- $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code inserted into node.'));
- return $node;
+ function createNodeWithCode() {
+ return $this->drupalCreateNode(array('body' => '<?php print "SimpleTest PHP was executed!"; ?>'));
}
}
@@ -58,10 +52,10 @@ class PHPFilterTestCase extends PHPTestCase {
// 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($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 is displayed.'));
// Change filter to PHP filter and see that PHP code is evaluated.
@@ -95,10 +89,10 @@ class PHPAccessTestCase extends PHPTestCase {
// 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($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 is displayed.'));
// Make sure that user doesn't have access to filter.