Skip to content
Permalink
Browse files

Remove use of TestCase::getMock() from "View" namepace tests.

  • Loading branch information...
ADmad committed Jun 5, 2016
1 parent 7fb1ea5 commit b5fed15d0780f69c7c349a9709e05e30044e14b6
@@ -199,7 +199,9 @@ public function testError()
$this->assertEquals([], $context->error('Alias.name'));
$this->assertEquals([], $context->error('nope.nope'));
$mock = $this->getMock('Cake\Validation\Validator', ['errors']);
$mock = $this->getMockBuilder('Cake\Validation\Validator')
->setMethods(['errors'])
->getMock();
$mock->expects($this->once())
->method('errors')
->willReturn(['key' => 'should be an array, not a string']);
@@ -399,7 +399,10 @@ public function testAddContextProviderInvalid()
public function contextSelectionProvider()
{
$entity = new Article();
$collection = $this->getMock('Cake\Collection\Collection', ['extract'], [[$entity]]);
$collection = $this->getMockBuilder('Cake\Collection\Collection')
->setMethods(['extract'])
->setConstructorArgs([[$entity]])
->getMock();
$emptyCollection = new Collection([]);
$emptyArray = [];
$arrayObject = new \ArrayObject([]);
@@ -3190,11 +3193,10 @@ public function testInputHidden()
*/
public function testInputDatetime()
{
$this->Form = $this->getMock(
'Cake\View\Helper\FormHelper',
['datetime'],
[new View()]
);
$this->Form = $this->getMockBuilder('Cake\View\Helper\FormHelper')
->setMethods(['datetime'])
->setConstructorArgs([new View()])
->getMock();
$this->Form->expects($this->once())->method('datetime')
->with('prueba', [
'type' => 'datetime',
@@ -3231,11 +3233,10 @@ public function testInputDatetime()
*/
public function testInputDatetimeIdPrefix()
{
$this->Form = $this->getMock(
'Cake\View\Helper\FormHelper',
['datetime'],
[new View()]
);
$this->Form = $this->getMockBuilder('Cake\View\Helper\FormHelper')
->setMethods(['datetime'])
->setConstructorArgs([new View()])
->getMock();
$this->Form->create(false, ['idPrefix' => 'prefix']);
@@ -58,7 +58,9 @@ class HtmlHelperTest extends TestCase
public function setUp()
{
parent::setUp();
$this->View = $this->getMock('Cake\View\View', ['append']);
$this->View = $this->getMockBuilder('Cake\View\View')
->setMethods(['append'])
->getMock();
$this->Html = new HtmlHelper($this->View);
$this->Html->request = new Request();
$this->Html->request->webroot = '';
@@ -107,7 +107,9 @@ public function methodProvider()
*/
public function testNumberHelperProxyMethodCalls($method)
{
$number = $this->getMock(__NAMESPACE__ . '\NumberMock', [$method]);
$number = $this->getMockBuilder(__NAMESPACE__ . '\NumberMock')
->setMethods([$method])
->getMock();
$helper = new NumberHelperTestObject($this->View, ['engine' => __NAMESPACE__ . '\NumberMock']);
$helper->attach($number);
$number->expects($this->at(0))
@@ -40,7 +40,9 @@ public function setUp()
Configure::write('Config.language', 'eng');
$this->View = new View();
$this->Paginator = new PaginatorHelper($this->View);
$this->Paginator->Js = $this->getMock('Cake\View\Helper\PaginatorHelper', [], [$this->View]);
$this->Paginator->Js = $this->getMockBuilder('Cake\View\Helper\PaginatorHelper')
->setConstructorArgs([$this->View])
->getMock();
$this->Paginator->request = new Request();
$this->Paginator->request->addParams([
'paging' => [
@@ -90,7 +90,9 @@ public function testTextHelperProxyMethodCalls()
$methods = [
'stripLinks', 'excerpt', 'toList'
];
$String = $this->getMock(__NAMESPACE__ . '\StringMock', $methods);
$String = $this->getMockBuilder(__NAMESPACE__ . '\StringMock')
->setMethods($methods)
->getMock();
$Text = new TextHelperTestObject($this->View, ['engine' => __NAMESPACE__ . '\StringMock']);
$Text->attach($String);
foreach ($methods as $method) {
@@ -101,7 +103,9 @@ public function testTextHelperProxyMethodCalls()
$methods = [
'highlight', 'truncate'
];
$String = $this->getMock(__NAMESPACE__ . '\StringMock', $methods);
$String = $this->getMockBuilder(__NAMESPACE__ . '\StringMock')
->setMethods($methods)
->getMock();
$Text = new TextHelperTestObject($this->View, ['engine' => __NAMESPACE__ . '\StringMock']);
$Text->attach($String);
foreach ($methods as $method) {
@@ -112,7 +116,9 @@ public function testTextHelperProxyMethodCalls()
$methods = [
'tail'
];
$String = $this->getMock(__NAMESPACE__ . '\StringMock', $methods);
$String = $this->getMockBuilder(__NAMESPACE__ . '\StringMock')
->setMethods($methods)
->getMock();
$Text = new TextHelperTestObject($this->View, ['engine' => __NAMESPACE__ . '\StringMock']);
$Text->attach($String);
foreach ($methods as $method) {

0 comments on commit b5fed15

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