Skip to content

Instantly share code, notes, and snippets.

@LubosRemplik
Last active March 9, 2018 13:54
Show Gist options
  • Save LubosRemplik/c79fc56571d00a403384785b94ec6e7d to your computer and use it in GitHub Desktop.
Save LubosRemplik/c79fc56571d00a403384785b94ec6e7d to your computer and use it in GitHub Desktop.
ServerRequest withAttribute / getParam fail in 3.6
<?php
namespace Admin\Test\TestCase\View\Cell;
use Admin\View\Cell\MenuCell;
use Cake\TestSuite\TestCase;
/**
* Admin\View\Cell\MenuCell Test Case
*/
class MenuCellTest extends TestCase
{
/**
* Request mock
*
* @var \Cake\Http\ServerRequest|\PHPUnit_Framework_MockObject_MockObject
*/
public $request;
/**
* Response mock
*
* @var \Cake\Http\Response|\PHPUnit_Framework_MockObject_MockObject
*/
public $response;
/**
* Test subject
*
* @var \Admin\View\Cell\MenuCell
*/
public $MenuCell;
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->request = $this->getMockBuilder('Cake\Http\ServerRequest')->getMock();
//$this->request = $this->request->withAttribute('params', ['controller' => 'Users']);
$this->request = $this->request->withParam('controller', 'Users');
debug($this->request->getParam('controller'));
}
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->MenuCell);
parent::tearDown();
}
public function testBadge()
{
$this->markTestIncomplete('Not implemented yet.');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment