Refactor tests and code to handle new 2FA methods.

This commit is contained in:
James Cole
2019-08-04 10:27:37 +02:00
parent d3be043aa7
commit 62b5cf04ad
12 changed files with 12 additions and 662 deletions

View File

@@ -102,19 +102,10 @@ class UserControllerTest extends TestCase
*/
public function testIndex(): void
{
die('this test references old 2FA code.');
$repository = $this->mock(UserRepositoryInterface::class);
$repository->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->times(3)->andReturn(true);
$user = $this->user();
$repository->shouldReceive('all')->andReturn(new Collection([$user]));
Preferences::shouldReceive('getArrayForUser')->atLeast()->once()->andReturn(
[
'twoFactorAuthEnabled' => false,
'twoFactorAuthSecret' => null,
]
);
$this->mockDefaultSession();
$this->be($user);