Skip to content
Permalink
Browse files

Add deprecated warning for deprecated method.

Fix failing tests.
  • Loading branch information...
markstory committed Sep 15, 2014
1 parent 3f110d0 commit 5d203b4c08b9c0372954bbb1e3072de61ab94f9d
@@ -454,6 +454,10 @@ public function implementedEvents() {
* @return void
*/
public function constructClasses() {
trigger_error(
'Controller::constructClasses() is deprecated and will be removed in the first RC release',
E_USER_DEPRECATED
);
}
/**
@@ -819,7 +819,7 @@ public function testForbiddenException() {
*/
public function testNoRedirectOnLoginAction() {
$event = new Event('Controller.startup', $this->Controller);
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->methods = array('login');
$url = '/AuthTest/login';
@@ -34,7 +34,7 @@ class CsrfComponentTest extends TestCase {
public function setUp() {
parent::setUp();
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$this->registry = new ComponentRegistry($controller);
$this->component = new CsrfComponent($this->registry);
}
@@ -57,7 +57,7 @@ public function tearDown() {
public function testSettingCookie() {
$_SERVER['REQUEST_METHOD'] = 'GET';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request(['base' => '/dir']);
$controller->response = new Response();
@@ -94,7 +94,7 @@ public function testValidTokenInHeader($method) {
$_SERVER['REQUEST_METHOD'] = $method;
$_SERVER['HTTP_X_CSRF_TOKEN'] = 'testing123';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request(['cookies' => ['csrfToken' => 'testing123']]);
$controller->response = new Response();
@@ -114,7 +114,7 @@ public function testInvalidTokenInHeader($method) {
$_SERVER['REQUEST_METHOD'] = $method;
$_SERVER['HTTP_X_CSRF_TOKEN'] = 'nope';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request([
'cookies' => ['csrfToken' => 'testing123']
]);
@@ -133,7 +133,7 @@ public function testInvalidTokenInHeader($method) {
public function testValidTokenRequestData($method) {
$_SERVER['REQUEST_METHOD'] = $method;
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request([
'post' => ['_csrfToken' => 'testing123'],
'cookies' => ['csrfToken' => 'testing123']
@@ -155,7 +155,7 @@ public function testValidTokenRequestData($method) {
public function testInvalidTokenRequestData($method) {
$_SERVER['REQUEST_METHOD'] = $method;
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request([
'post' => ['_csrfToken' => 'nope'],
'cookies' => ['csrfToken' => 'testing123']
@@ -174,7 +174,7 @@ public function testInvalidTokenRequestData($method) {
public function testCsrfValidationSkipsRequestAction() {
$_SERVER['REQUEST_METHOD'] = 'POST';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request([
'params' => ['requested' => 1],
'post' => ['_csrfToken' => 'nope'],
@@ -196,7 +196,7 @@ public function testCsrfValidationSkipsRequestAction() {
public function testConfigurationCookieCreate() {
$_SERVER['REQUEST_METHOD'] = 'GET';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request(['base' => '/dir']);
$controller->response = new Response();
@@ -226,7 +226,7 @@ public function testConfigurationCookieCreate() {
public function testConfigurationValidate() {
$_SERVER['REQUEST_METHOD'] = 'POST';
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request([
'cookies' => ['csrfToken' => 'nope', 'token' => 'yes'],
'post' => ['_csrfToken' => 'no match', 'token' => 'yes'],
@@ -97,7 +97,7 @@ public function testConstructorConfig() {
$config = array(
'viewClassMap' => array('json' => 'MyPlugin.MyJson')
);
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$collection = new ComponentRegistry($controller);
$requestHandler = new RequestHandlerComponent($collection, $config);
$this->assertEquals(array('json' => 'MyPlugin.MyJson'), $requestHandler->config('viewClassMap'));
@@ -63,7 +63,7 @@ class HtmlHelperTest extends TestCase {
*/
public function setUp() {
parent::setUp();
$controller = $this->getMock('Cake\Controller\Controller');
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$this->View = $this->getMock('Cake\View\View', array('append'));
$this->Html = new HtmlHelper($this->View);
$this->Html->request = new Request();

0 comments on commit 5d203b4

Please sign in to comment.
You can’t perform that action at this time.