Unverified Commit 12b00a23 authored by Thomas Müller's avatar Thomas Müller
Browse files

Fixing tests ...

parent 8b064e1f
......@@ -60,7 +60,6 @@ class HookManagerTest extends TestCase {
$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 @@ class HookManagerTest extends TestCase {
'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 @@ class HookManagerTest extends TestCase {
$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 @@ class HookManagerTest extends TestCase {
$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 @@ class HookManagerTest extends TestCase {
$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 @@ class HookManagerTest extends TestCase {
'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() {
......
......@@ -332,6 +332,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
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)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment