use phpunit's createMock for interfaces

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2016-11-07 14:57:47 +01:00
Родитель 5c4487a818
Коммит 3dfa737e73
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -39,16 +39,16 @@ class SettingsControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
$this->request = $this->getMock('\OCP\IRequest');
$this->userSession = $this->getMock('\OCP\IUserSession');
$this->totp = $this->getMock('\OCA\TwoFactorTOTP\Service\ITotp');
$this->request = $this->createMock('\OCP\IRequest');
$this->userSession = $this->createMock('\OCP\IUserSession');
$this->totp = $this->createMock('\OCA\TwoFactorTOTP\Service\ITotp');
$this->defaults = new Defaults();
$this->controller = new SettingsController('twofactor_totp', $this->request, $this->userSession, $this->totp, $this->defaults);
}
public function testNothing() {
$user = $this->getMock('\OCP\IUser');
$user = $this->createMock('\OCP\IUser');
$this->userSession->expects($this->once())
->method('getUser')
->will($this->returnValue($user));
@ -65,7 +65,7 @@ class SettingsControllerTest extends TestCase {
}
public function testEnable() {
$user = $this->getMock('\OCP\IUser');
$user = $this->createMock('\OCP\IUser');
$this->userSession->expects($this->exactly(2))
->method('getUser')
->will($this->returnValue($user));
@ -93,7 +93,7 @@ class SettingsControllerTest extends TestCase {
}
public function testEnableDisable() {
$user = $this->getMock('\OCP\IUser');
$user = $this->createMock('\OCP\IUser');
$this->userSession->expects($this->once())
->method('getUser')
->will($this->returnValue($user));