Fix tests
Signed-off-by: Tobia De Koninck <tobia@ledfan.be>
This commit is contained in:
parent
6f4976fd4d
commit
88ccbef546
|
@ -106,7 +106,9 @@ class ContactsStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups) {
|
$selfUID = $self->getUID();
|
||||||
|
|
||||||
|
return array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID) {
|
||||||
|
|
||||||
if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) {
|
if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -120,7 +122,7 @@ class ContactsStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entry->getProperty('UID') !== $self->getUID();
|
return $entry->getProperty('UID') !== $selfUID;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,10 @@ namespace Tests\Contacts\ContactsMenu;
|
||||||
|
|
||||||
use OC\Contacts\ContactsMenu\ContactsStore;
|
use OC\Contacts\ContactsMenu\ContactsStore;
|
||||||
use OCP\Contacts\IManager;
|
use OCP\Contacts\IManager;
|
||||||
|
use OCP\IConfig;
|
||||||
|
use OCP\IGroupManager;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
|
use OCP\IUserManager;
|
||||||
use PHPUnit_Framework_MockObject_MockObject;
|
use PHPUnit_Framework_MockObject_MockObject;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
|
@ -38,12 +41,27 @@ class ContactsStoreTest extends TestCase {
|
||||||
/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $contactsManager;
|
private $contactsManager;
|
||||||
|
|
||||||
|
/** @var IUserManager|PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
private $userManager;
|
||||||
|
|
||||||
|
/** @var IGroupManager|PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
private $groupManager;
|
||||||
|
|
||||||
|
/** @var IConfig|PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
private $config;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->contactsManager = $this->createMock(IManager::class);
|
$this->contactsManager = $this->createMock(IManager::class);
|
||||||
|
|
||||||
$this->contactsStore = new ContactsStore($this->contactsManager);
|
$this->userManager = $this->createMock(IUserManager::class);
|
||||||
|
|
||||||
|
$this->groupManager = $this->createMock(IGroupManager::class);
|
||||||
|
|
||||||
|
$this->config = $this->createMock(IConfig::class);
|
||||||
|
|
||||||
|
$this->contactsStore = new ContactsStore($this->contactsManager, $this->config, $this->userManager, $this->groupManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetContactsWithoutFilter() {
|
public function testGetContactsWithoutFilter() {
|
||||||
|
|
Loading…
Reference in New Issue