mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding test cases for additional require methods or the remaining HTTP verbs/methods. Refs #4231
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6698 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ed51f78227
commit
4ced59868a
1 changed files with 40 additions and 0 deletions
|
@ -65,6 +65,46 @@ class SecurityComponentTest extends CakeTestCase {
|
||||||
$this->assertTrue($this->Controller->Session->check('_Token'));
|
$this->assertTrue($this->Controller->Session->check('_Token'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testRequirePost()
|
||||||
|
{
|
||||||
|
$this->Controller->action = 'posted';
|
||||||
|
$this->Controller->Security->startup($this->Controller);
|
||||||
|
$this->Controller->Security->requirePost('posted');
|
||||||
|
$this->assertNull($this->Controller->Security->__postRequired($this->Controller));
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
|
$this->assertTrue($this->Controller->Security->__postRequired($this->Controller));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRequireGet()
|
||||||
|
{
|
||||||
|
$this->Controller->action = 'getted';
|
||||||
|
$this->Controller->Security->startup($this->Controller);
|
||||||
|
$this->Controller->Security->requireGet('getted');
|
||||||
|
$this->assertNull($this->Controller->Security->__getRequired($this->Controller));
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'GET';
|
||||||
|
$this->assertTrue($this->Controller->Security->__getRequired($this->Controller));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRequirePut()
|
||||||
|
{
|
||||||
|
$this->Controller->action = 'putted';
|
||||||
|
$this->Controller->Security->startup($this->Controller);
|
||||||
|
$this->Controller->Security->requirePut('putted');
|
||||||
|
$this->assertNull($this->Controller->Security->__putRequired($this->Controller));
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||||
|
$this->assertTrue($this->Controller->Security->__putRequired($this->Controller));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testRequireDelete()
|
||||||
|
{
|
||||||
|
$this->Controller->action = 'deleted';
|
||||||
|
$this->Controller->Security->startup($this->Controller);
|
||||||
|
$this->Controller->Security->requireDelete('deleted');
|
||||||
|
$this->assertNull($this->Controller->Security->__deleteRequired($this->Controller));
|
||||||
|
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||||
|
$this->assertTrue($this->Controller->Security->__deleteRequired($this->Controller));
|
||||||
|
}
|
||||||
|
|
||||||
function testValidatePostNoModel() {
|
function testValidatePostNoModel() {
|
||||||
$this->Controller->Security->startup($this->Controller);
|
$this->Controller->Security->startup($this->Controller);
|
||||||
$key = $this->Controller->params['_Token']['key'];
|
$key = $this->Controller->params['_Token']['key'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue