Permalink
Browse files

Fixing more tests for phpunit 4.0

  • Loading branch information...
1 parent 220578a commit eca2bfdd812063160ea62491db4873e72e4f307f @lorenzo lorenzo committed Mar 10, 2014
Showing with 8 additions and 6 deletions.
  1. +8 −6 tests/TestCase/Controller/ControllerTest.php
@@ -368,7 +368,7 @@ public function testRender() {
*/
public function testBeforeRenderCallbackChangingViewClass() {
Configure::write('App.namespace', 'TestApp');
- $Controller = new Controller($this->getMock('Cake\Network\Request'), new Response());
+ $Controller = new Controller(new Request, new Response());
$Controller->getEventManager()->attach(function ($event) {
$controller = $event->subject();
@@ -392,7 +392,7 @@ public function testBeforeRenderCallbackChangingViewClass() {
* @return void
*/
public function testBeforeRenderEventCancelsRender() {
- $Controller = new Controller($this->getMock('Cake\Network\Request'), new Response());
+ $Controller = new Controller(new Request, new Response());
$Controller->getEventManager()->attach(function ($event) {
return false;
@@ -567,8 +567,7 @@ public function testMergeVarsNotGreedy() {
* @return void
*/
public function testReferer() {
- $request = $this->getMock('Cake\Network\Request');
-
+ $request = $this->getMock('Cake\Network\Request', ['referer']);
$request->expects($this->any())->method('referer')
->with(true)
->will($this->returnValue('/posts/index'));
@@ -577,12 +576,15 @@ public function testReferer() {
$result = $Controller->referer(null, true);
$this->assertEquals('/posts/index', $result);
+ $request = $this->getMock('Cake\Network\Request', ['referer']);
+ $request->expects($this->any())->method('referer')
+ ->with(true)
+ ->will($this->returnValue('/'));
$Controller = new Controller($request);
- $request->setReturnValue('referer', '/', array(true));
$result = $Controller->referer(array('controller' => 'posts', 'action' => 'index'), true);
$this->assertEquals('/posts/index', $result);
- $request = $this->getMock('Cake\Network\Request');
+ $request = $this->getMock('Cake\Network\Request', ['referer']);
$request->expects($this->any())->method('referer')
->with(false)

0 comments on commit eca2bfd

Please sign in to comment.