Skip to content

Commit

Permalink
Update use of deprecated method.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 22, 2020
1 parent 77b297b commit 0cf2b21
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions tests/TestCase/Controller/Component/SearchComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Search\Test\TestCase\Controller\Component;

use Cake\Controller\Controller;
use Cake\Http\Response;
use Cake\Http\ServerRequest;
use Cake\ORM\Table;
use Cake\Routing\RouteBuilder;
Expand Down Expand Up @@ -47,10 +48,7 @@ public function setUp(): void
$routes->fallbacks();
});
$request = new ServerRequest();
$response = $this
->getMockBuilder('Cake\Http\Response')
->setMethods(['stop'])
->getMock();
$response = new Response();

$this->Controller = new Controller($request, $response);
$this->Search = new SearchComponent($this->Controller->components());
Expand Down Expand Up @@ -278,7 +276,7 @@ public function testIsSearchTrue()
])
);
$this->Controller->modelClass = 'SomePlugin.Articles';
$this->Controller->Articles = $this->getMockBuilder(Table::class)->setMethods(['isSearch'])->getMock();
$this->Controller->Articles = $this->getMockBuilder(Table::class)->addMethods(['isSearch'])->getMock();
$this->Controller->Articles->addBehavior('Search.Search');
$this->Controller->Articles->expects($this->once())->method('isSearch')->willReturn(true);

Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Model/Behavior/SearchBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testProcessFilters()
$behavior = $this
->getMockBuilder('Search\Model\Behavior\SearchBehavior')
->setConstructorArgs([$this->Comments])
->setMethods(['_getFilters'])
->onlyMethods(['_getFilters'])
->getMock();
$this->Comments->behaviors()->reset();
$this->Comments->addBehavior('Search', [
Expand All @@ -93,7 +93,7 @@ public function testProcessFilters()
$filter = $this
->getMockBuilder('\Search\Test\TestApp\Model\Filter\TestFilter')
->setConstructorArgs(['name', $manager])
->setMethods(['setArgs', 'skip', 'process', 'setQuery'])
->onlyMethods(['setArgs', 'skip', 'process', 'setQuery'])
->getMock();
$filter
->expects($this->once())
Expand All @@ -115,7 +115,7 @@ public function testProcessFilters()
$filter2 = $this
->getMockBuilder('\Search\Test\TestApp\Model\Filter\TestFilter')
->setConstructorArgs(['name', $manager, ['flatten' => false]])
->setMethods(['setArgs', 'skip', 'process', 'setQuery'])
->onlyMethods(['setArgs', 'skip', 'process', 'setQuery'])
->getMock();
$filter2
->expects($this->once())
Expand All @@ -137,7 +137,7 @@ public function testProcessFilters()
$filter3 = $this
->getMockBuilder('\Search\Test\TestApp\Model\Filter\TestFilter')
->setConstructorArgs(['name', $manager])
->setMethods(['setArgs', 'skip', 'process', 'setQuery'])
->onlyMethods(['setArgs', 'skip', 'process', 'setQuery'])
->getMock();
$filter3
->expects($this->once())
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Model/Filter/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public function testBeforeProcessCallback()
public function testBeforeProcessReturnFalse()
{
$filter = $this->getMockBuilder(TestFilter::class)
->setMethods(['process'])
->onlyMethods(['process'])
->setConstructorArgs([
'fields',
$this->Manager,
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Model/SearchTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function setUp(): void
'driver' => $driverMock,
],
])
->setMethods(['getWebservice'])
->addMethods(['getWebservice'])
->getMock();
$connectionMock
->method('getWebservice')
Expand Down

0 comments on commit 0cf2b21

Please sign in to comment.