From 43d9b75e51cca2fd60fd477340558cd0de8f228d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 23 Sep 2016 23:45:08 +0200 Subject: [PATCH] Fixing tests ... --- apps/dav/tests/unit/DAV/HookManagerTest.php | 9 +++------ tests/lib/TestCase.php | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/dav/tests/unit/DAV/HookManagerTest.php b/apps/dav/tests/unit/DAV/HookManagerTest.php index 4a0e65e4cbce..d79da2f45d51 100644 --- a/apps/dav/tests/unit/DAV/HookManagerTest.php +++ b/apps/dav/tests/unit/DAV/HookManagerTest.php @@ -60,7 +60,6 @@ public function test() { $userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $userManager->expects($this->once())->method('get')->willReturn($user); /** @var SyncService | \PHPUnit_Framework_MockObject_MockObject $syncService */ $syncService = $this->getMockBuilder(SyncService::class) @@ -90,7 +89,7 @@ public function test() { 'contacts', ['{DAV:}displayname' => $this->l10n->t('Contacts')]); $hm = new HookManager($userManager, $syncService, $cal, $card, $this->l10n); - $hm->postLogin(['uid' => 'newUser']); + $hm->firstLogin($user); } public function testWithExisting() { @@ -103,7 +102,6 @@ public function testWithExisting() { $userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $userManager->expects($this->once())->method('get')->willReturn($user); /** @var SyncService | \PHPUnit_Framework_MockObject_MockObject $syncService */ $syncService = $this->getMockBuilder(SyncService::class) @@ -129,7 +127,7 @@ public function testWithExisting() { $card->expects($this->never())->method('createAddressBook'); $hm = new HookManager($userManager, $syncService, $cal, $card, $this->l10n); - $hm->postLogin(['uid' => 'newUser']); + $hm->firstLogin($user); } public function testWithBirthdayCalendar() { @@ -142,7 +140,6 @@ public function testWithBirthdayCalendar() { $userManager = $this->getMockBuilder(IUserManager::class) ->disableOriginalConstructor() ->getMock(); - $userManager->expects($this->once())->method('get')->willReturn($user); /** @var SyncService | \PHPUnit_Framework_MockObject_MockObject $syncService */ $syncService = $this->getMockBuilder(SyncService::class) @@ -174,7 +171,7 @@ public function testWithBirthdayCalendar() { 'contacts', ['{DAV:}displayname' => $this->l10n->t('Contacts')]); $hm = new HookManager($userManager, $syncService, $cal, $card, $this->l10n); - $hm->postLogin(['uid' => 'newUser']); + $hm->firstLogin($user); } public function testDeleteCalendar() { diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index 575dab0c248c..bf63d8c4d6af 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -332,6 +332,7 @@ static protected function tearDownAfterClassCleanStrayLocks() { static protected function loginAsUser($user = '') { self::logout(); \OC\Files\Filesystem::tearDown(); + \OC::$server->getConfig()->setUserValue($user, 'login', 'lastLogin', time()); \OC_User::setUserId($user); \OC_Util::setupFS($user); if (\OC_User::userExists($user)) {