Skip to content
Browse files

Affecting the REQUEST_METHOD env variable in order to ease controller…

… testing with different http verbs
  • Loading branch information...
1 parent f94394f commit 40ba4005bdc9b0a50febf27e3273052718fbeaf7 @lorenzo lorenzo committed
View
1 lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
@@ -390,6 +390,7 @@ public function testTestActionPostData() {
$result = $this->Case->testAction('/tests_apps_posts/add', array('return' => 'vars'));
$this->assertTrue(array_key_exists('posts', $result));
$this->assertEqual(count($result['posts']), 4);
+ $this->assertTrue($this->Case->controller->request->is('post'));
}
/**
View
1 lib/Cake/TestSuite/ControllerTestCase.php
@@ -190,6 +190,7 @@ protected function _testAction($url = '', $options = array()) {
'return' => 'result'
), $options);
+ $_SERVER['REQUEST_METHOD'] = strtoupper($options['method']);
if (strtoupper($options['method']) == 'GET') {
$_GET = $options['data'];
$_POST = array();

0 comments on commit 40ba400

Please sign in to comment.
Something went wrong with that request. Please try again.