? patches
? modules/system/custom_access_denied_test_2.patch
? sites/patchwork.jonathan.local
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.12
diff -u -p -r1.12 system.test
--- modules/system/system.test	15 Sep 2008 20:48:09 -0000	1.12
+++ modules/system/system.test	8 Oct 2008 02:17:54 -0000
@@ -321,7 +321,7 @@ class AdminMetaTagTestCase extends Drupa
   }
 }
 
-class PageNotFoundTestCase extends DrupalWebTestCase {
+class PageNotFoundAndAccessDeniedTestCase extends DrupalWebTestCase {
   protected $admin_user;
 
   /**
@@ -329,8 +329,8 @@ class PageNotFoundTestCase extends Drupa
    */
   function getInfo() {
     return array(
-      'name' => t('404 functionality'),
-      'description' => t("Tests page not found functionality, including custom 404 pages."),
+      'name' => t('404 & 403 functionality'),
+      'description' => t("Tests page not found and access denied functionality, including custom 404 and 403 pages."),
       'group' => t('System')
     );
   }
@@ -380,4 +380,37 @@ class PageNotFoundTestCase extends Drupa
     $this->assertText(t('Page not found'), t('Found the default 404 page'));
     $this->assertNoText(t('User login'), t('Blocks are not shown on the default 404 page'));
   }
+
+  function testAccessDenied() {
+    $this->drupalGet('node/add');
+    $this->assertText(t('Access denied'), t('Found the default 403 page'));
+
+    $edit = array(
+      'title' => $this->randomName(10),
+      'body' => $this->randomName(100)
+    );
+    $node = $this->drupalCreateNode($edit);
+
+    // Use a custom 403 page.
+    $this->drupalPost('admin/settings/error-reporting', array('site_403' => 'node/' . $node->nid), t('Save configuration'));
+
+    $this->drupalGet('node/add');
+    $this->assertText($node->title, t('Found the custom 403 page'));
+
+    // Logout and check another page other than node/add.
+    $this->drupalLogout();
+
+    $this->drupalGet('admin');
+    $this->assertText($node->title, t('Found the custom 403 page'));
+
+    // Log back in and remove the custom 403 page.
+    $this->drupalLogin($this->admin_user);
+    $this->drupalPost('admin/settings/error-reporting', array(), t('Reset to defaults'));
+
+    // Logout and check that default 403 page is restored.
+    $this->drupalLogout();
+
+    $this->drupalGet('admin');
+    $this->assertText(t('Access denied'), t('Found the default 403 page'));
+  }
 }
