Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
294
Merge Requests
294
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
047b4bde
Commit
047b4bde
authored
Oct 11, 2008
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#296306
by swentel: Test for custom 403 page.
parent
cede322c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
modules/system/system.test
modules/system/system.test
+64
-0
No files found.
modules/system/system.test
View file @
047b4bde
...
...
@@ -333,6 +333,70 @@ class AdminMetaTagTestCase extends DrupalWebTestCase {
}
}
/**
* Tests custom access denied functionality.
*/
class
AccessDeniedTestCase
extends
DrupalWebTestCase
{
protected
$admin_user
;
/**
* Implementation of getInfo().
*/
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'403 functionality'
),
'description'
=>
t
(
"Tests page access denied functionality, including custom 403 pages."
),
'group'
=>
t
(
'System'
)
);
}
/**
* Implementation of setUp().
*/
function
setUp
()
{
parent
::
setUp
();
// Create an administrative user.
$this
->
admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer site configuration'
));
$this
->
drupalLogin
(
$this
->
admin_user
);
}
function
testAccessDenied
()
{
$this
->
drupalGet
(
'admin'
);
$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
(
'admin'
);
$this
->
assertText
(
$node
->
title
,
t
(
'Found the custom 403 page'
));
// Logout and check that the user login block is shown on custom 403 pages.
$this
->
drupalLogout
();
$this
->
drupalGet
(
'admin'
);
$this
->
assertText
(
$node
->
title
,
t
(
'Found the custom 403 page'
));
$this
->
assertText
(
t
(
'User login'
),
t
(
'Blocks are shown on 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 the user login block is shown on default 403 pages.
$this
->
drupalLogout
();
$this
->
drupalGet
(
'admin'
);
$this
->
assertText
(
t
(
'Access denied'
),
t
(
'Found the default 403 page'
));
$this
->
assertText
(
t
(
'User login'
),
t
(
'Blocks are shown on the default 403 page'
));
}
}
class
PageNotFoundTestCase
extends
DrupalWebTestCase
{
protected
$admin_user
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment