? accessdenied.test ? pagenotfound.patch Index: pagenotfound.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/customerror/tests/pagenotfound.test,v retrieving revision 1.1 diff -u -p -r1.1 pagenotfound.test --- pagenotfound.test 27 Dec 2007 20:11:39 -0000 1.1 +++ pagenotfound.test 28 Dec 2007 11:05:16 -0000 @@ -10,33 +10,37 @@ class PageNotFoundTest extends DrupalTes } function testPageNotFoundMessage() { - - /* Enable CustomError module */ - $this->drupalModuleEnable('customerror'); + + /* Enable CustomError module */ + $this->drupalModuleEnable('customerror'); - /* Set title and text of error message */ - $error_code = 404; - $title = $this->randomName($number = 10, $prefix = 'simpletest_'); - $this->drupalVariableSet('customerror_'. $error_code .'_title', $title); - - $description = $this->randomName($number = 512, $prefix = 'simpletest_'); - $this->drupalVariableSet('customerror_'. $error_code, $description); - - /* Access error page directly, check for title and text of error message */ - $this->get(url('customerror/'. $error_code, NULL, NULL, TRUE)); - $this->assertText($title, 'Title on '. $error_code .' error page set when accessed directly'); - $this->assertText($description, 'Description on '. $error_code .' error page set when accessed directly'); - - /* Point Drupal to the new error message */ - $this->drupalVariableSet('site_'. $error_code, 'customerror/'. $error_code); + /* Set title and text of error message */ + $error_code = 404; + $title = $this->randomName($number = 10, $prefix = 'simpletest_'); + $this->drupalVariableSet('customerror_'. $error_code .'_title', $title); + + $description = $this->randomName($number = 512, $prefix = 'simpletest_'); + $this->drupalVariableSet('customerror_'. $error_code, $description); + + /* Access error page directly, check for title and text of error message */ + $this->get(url('customerror/'. $error_code, NULL, NULL, TRUE)); + $this->assertText($title, 'Title on '. $error_code .' error page set when accessed directly'); + $this->assertText($description, 'Description on '. $error_code .' error page set when accessed directly'); + + /* Point Drupal to the new error message */ + $this->drupalVariableSet('site_'. $error_code, 'customerror/'. $error_code); + + /* Log in as a user with basic privileges */ + $user = $this->drupalCreateUserRolePerm(array('access content')); + $this->drupalLoginUser($user); /* Access next node ID, shouldn't exist yet. Note that this increments the nid each time it's run. */ - $this->get(url('node/'. db_next_id('{node}_nid'), NULL, NULL, TRUE)); + $this->get(url('node/'. db_next_id('{node}_nid'), NULL, NULL, TRUE)); - /* Check for response code, title and text of error message */ + /* Check for response code, title and text of error message */ $this->assertResponse($error_code, 'Response code on '. $error_code .' error page set when accessed at non-existent URL'); - $this->assertText($title, 'Title on '. $error_code .' error page set when accessed at non-existent URL'); - $this->assertText($description, 'Description on '. $error_code .' error page set when accessed at non-existent URL'); + $this->assertText($title, 'Title on '. $error_code .' error page set when accessed at non-existent URL'); + $this->assertText($description, 'Description on '. $error_code .' error page set when accessed at non-existent URL'); /* Could also create node, prove it's accessible, delete it, then try to access again and prove it's gone */