Adds tests for the AuthSettingsController
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
59d6003f89
commit
311531ecce
|
@ -42,6 +42,7 @@ class AuthSettingsControllerTest extends TestCase {
|
||||||
/** @var AuthSettingsController */
|
/** @var AuthSettingsController */
|
||||||
private $controller;
|
private $controller;
|
||||||
private $request;
|
private $request;
|
||||||
|
/** @var IProvider|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $tokenProvider;
|
private $tokenProvider;
|
||||||
private $userManager;
|
private $userManager;
|
||||||
private $session;
|
private $session;
|
||||||
|
@ -200,4 +201,26 @@ class AuthSettingsControllerTest extends TestCase {
|
||||||
$this->assertEquals([], $this->controller->destroy($id));
|
$this->assertEquals([], $this->controller->destroy($id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testUpdateToken() {
|
||||||
|
$token = $this->createMock(DefaultToken::class);
|
||||||
|
|
||||||
|
$this->tokenProvider->expects($this->once())
|
||||||
|
->method('getTokenById')
|
||||||
|
->with($this->equalTo(42))
|
||||||
|
->willReturn($token);
|
||||||
|
|
||||||
|
$token->expects($this->once())
|
||||||
|
->method('setScope')
|
||||||
|
->with($this->equalTo([
|
||||||
|
'filesystem' => true,
|
||||||
|
'app' => ['dav', 'myapp']
|
||||||
|
]));
|
||||||
|
|
||||||
|
$this->tokenProvider->expects($this->once())
|
||||||
|
->method('updateToken')
|
||||||
|
->with($this->equalTo($token));
|
||||||
|
|
||||||
|
$this->assertSame([], $this->controller->update(42, ['filesystem' => true, 'apps' => ['dav', 'myapp']]));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue