? patches
? sites/patchwork.jonathan.local
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.7
diff -u -p -r1.7 common.test
--- modules/simpletest/tests/common.test	17 Sep 2008 07:01:31 -0000	1.7
+++ modules/simpletest/tests/common.test	2 Oct 2008 11:27:48 -0000
@@ -251,3 +251,45 @@ class DrupalSetContentTestCase extends D
     }
   }
 }
+
+/**
+ * Test for setting a custom access denied page.
+ */
+class DrupalCustomAccessDeniedTestCase extends DrupalWebTestCase {
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Custom access denied'),
+      'description' => t("Performs tests on Drupal's custom access denied page."),
+      'group' => t('System')
+    );
+  }
+
+  /**
+   * Tests custom access denied pages.
+   */
+  function testDrupalCustomAccessDenied() {
+    $user = $this->drupalCreateUser(array('administer site configuration'));
+    $this->drupalLogin($user);
+
+    // Create the custom 403 page.
+    $node = $this->drupalCreateNode();
+
+    // Set the drupal setting for the custom 403 page.
+    $edit = array('site_403' => 'node/'. $node->nid);
+    $this->drupalPost('admin/settings/error-reporting', $edit, t('Save configuration'));
+
+    // Log the admin user out.
+    $this->drupalLogout();
+
+    // Try to go to arbitrary page that should respond in a 403 error.
+    $this->drupalGet('node/add/page');
+
+    // We should get our custom 403 page.
+    $this->assertResponse(403, 'Access denied code.');
+    $this->assertText($node->title, t('The custom access denied title was displayed.'));
+    $this->assertText($node->body, t('The custom access denied body was displayed.'));
+  }
+}
\ No newline at end of file
