Skip to content

Commit

Permalink
Affecting the REQUEST_METHOD env variable in order to ease controller…
Browse files Browse the repository at this point in the history
… testing with different http verbs
  • Loading branch information
lorenzo committed Aug 29, 2011
1 parent f94394f commit 40ba400
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
Expand Up @@ -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'));
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/TestSuite/ControllerTestCase.php
Expand Up @@ -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();
Expand Down

0 comments on commit 40ba400

Please sign in to comment.