Skip to content

Commit

Permalink
Fixing tests ...
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Sep 29, 2016
1 parent 202e102 commit 43d9b75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 3 additions & 6 deletions apps/dav/tests/unit/DAV/HookManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand All @@ -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)
Expand All @@ -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() {
Expand All @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions tests/lib/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 43d9b75

Please sign in to comment.