Skip to content

Commit

Permalink
Fixing more tests for phpunit 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 10, 2014
1 parent 220578a commit eca2bfd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/TestCase/Controller/ControllerTest.php
Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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'));
Expand All @@ -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)
Expand Down

0 comments on commit eca2bfd

Please sign in to comment.