Skip to content

Commit

Permalink
Merge pull request #62 from nextcloud/deprecated-phpunit-getmock
Browse files Browse the repository at this point in the history
replace deprecated getMock method with mock builder
  • Loading branch information
ChristophWurst authored Sep 14, 2016
2 parents 2533138 + 5448622 commit f8bb1a2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/command/createaccounttest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function setUp() {
$this->service = $this->getMockBuilder('\OCA\Mail\Service\AccountService')
->disableOriginalConstructor()
->getMock();
$this->crypto = $this->getMock('\OCP\Security\ICrypto');
$this->crypto = $this->getMockBuilder('\OCP\Security\ICrypto')->getMock();

$this->command = new CreateAccount($this->service, $this->crypto);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/controller/autoconfigcontrollertest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AutoConfigControllerTest extends TestCase {
protected function setUp() {
parent::setUp();

$this->request = $this->getMock('OCP\IRequest');
$this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
$this->service = $this->getMockBuilder('OCA\Mail\Service\AutoCompletion\AutoCompleteService')
->disableOriginalConstructor()
->getMock();
Expand Down
4 changes: 2 additions & 2 deletions tests/controller/pagecontrollertest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ protected function setUp() {
}

public function testIndex() {
$account1 = $this->getMock('OCA\Mail\Service\IAccount');
$account2 = $this->getMock('OCA\Mail\Service\IAccount');
$account1 = $this->getMockBuilder('OCA\Mail\Service\IAccount')->getMock();
$account2 = $this->getMockBuilder('OCA\Mail\Service\IAccount')->getMock();

$this->accountService->expects($this->once())
->method('findByUserId')
Expand Down
4 changes: 2 additions & 2 deletions tests/controller/proxycontrollertest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected function setUp() {
$this->session = $this->getMockBuilder('\OCP\ISession')
->disableOriginalConstructor()
->getMock();
$this->clientService = $this->getMock('\OCP\Http\Client\IClientService');
$this->client = $this->getMock('\OCP\Http\Client\IClient');
$this->clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService')->getMock();
$this->client = $this->getMockBuilder('\OCP\Http\Client\IClient')->getMock();
$this->clientService->expects($this->any())
->method('getClient')
->will($this->returnValue($this->client));
Expand Down
2 changes: 1 addition & 1 deletion tests/service/loggertest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LoggerTest extends TestCase {
*/
public function testLoggerMethod($method, $param = '1') {

$baseLogger = $this->getMock('\OCP\ILogger');
$baseLogger = $this->getMockBuilder('\OCP\ILogger')->getMock();
$baseLogger->expects($this->once())
->method($method)
->with(
Expand Down

0 comments on commit f8bb1a2

Please sign in to comment.