|
|
@@ -567,14 +567,14 @@ class SecurityComponentTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testValidatePostFormHacking method
|
|
|
+ * testValidatePostFormTampering method
|
|
|
*
|
|
|
* Test that validatePost fails if any of its required fields are missing.
|
|
|
*
|
|
|
* @return void
|
|
|
* @triggers Controller.startup $this->Controller
|
|
|
*/
|
|
|
- public function testValidatePostFormHacking()
|
|
|
+ public function testValidatePostFormTampering()
|
|
|
{
|
|
|
$event = new Event('Controller.startup', $this->Controller);
|
|
|
$this->Security->startup($event);
|
|
|
@@ -1140,6 +1140,30 @@ class SecurityComponentTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Test that invalid types cause failures.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testValidatePostFailArrayData()
|
|
|
+ {
|
|
|
+ $event = new Event('Controller.startup', $this->Controller);
|
|
|
+ $this->Security->startup($event);
|
|
|
+ $this->Controller->request = $this->Controller->request->withParsedBody([
|
|
|
+ 'Model' => [
|
|
|
+ 'username' => 'mark',
|
|
|
+ 'password' => 'sekret',
|
|
|
+ ],
|
|
|
+ '_Token' => [
|
|
|
+ 'fields' => [],
|
|
|
+ 'unlocked' => '',
|
|
|
+ ],
|
|
|
+ ]);
|
|
|
+ Configure::write('debug', false);
|
|
|
+ $result = $this->validatePost('SecurityException', "'_Token.fields' was invalid.");
|
|
|
+ $this->assertFalse($result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* testValidateHiddenMultipleModel method
|
|
|
*
|
|
|
* @return void
|