Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iandenh committed Jun 14, 2017
1 parent d6f16ad commit 99ff442
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/TestCase/TestSuite/IntegrationTestCaseTest.php
Expand Up @@ -40,6 +40,8 @@ public function setUp()
Configure::write('App.namespace', 'TestApp');

Router::connect('/get/:controller/:action', ['_method' => 'GET'], ['routeClass' => 'InflectedRoute']);
Router::connect('/head/:controller/:action', ['_method' => 'HEAD'], ['routeClass' => 'InflectedRoute']);
Router::connect('/options/:controller/:action', ['_method' => 'OPTIONS'], ['routeClass' => 'InflectedRoute']);
Router::connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']);
DispatcherFactory::clear();
DispatcherFactory::add('Routing');
Expand Down Expand Up @@ -187,6 +189,44 @@ public function testGet()
$this->assertEquals('This is a test', $this->_response->body());
}

/**
* Test sending head requests.
*
* @return void
*/
public function testHead()
{
$this->assertNull($this->_response);

$this->head('/request_action/test_request_action');
$this->assertNotEmpty($this->_response);
$this->assertInstanceOf('Cake\Http\Response', $this->_response);
$this->assertResponseSuccess();

$this->_response = null;
$this->head('/head/request_action/test_request_action');
$this->assertResponseSuccess();
}

/**
* Test sending options requests.
*
* @return void
*/
public function testOptions()
{
$this->assertNull($this->_response);

$this->options('/request_action/test_request_action');
$this->assertNotEmpty($this->_response);
$this->assertInstanceOf('Cake\Http\Response', $this->_response);
$this->assertResponseSuccess();

$this->_response = null;
$this->options('/options/request_action/test_request_action');
$this->assertResponseSuccess();
}

/**
* Test sending get requests sets the request method
*
Expand Down

0 comments on commit 99ff442

Please sign in to comment.