Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make mock config return default value to fix warnings
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Nov 23, 2021
commit cd72045433eafc8f73a620239dc5afa6a0a6d84d
13 changes: 12 additions & 1 deletion tests/lib/Files/Config/UserMountCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ class UserMountCacheTest extends TestCase {
protected function setUp(): void {
$this->fileIds = [];
$this->connection = \OC::$server->getDatabaseConnection();
$this->userManager = new Manager($this->createMock(IConfig::class), $this->createMock(EventDispatcherInterface::class), $this->createMock(ICacheFactory::class), $this->createMock(IEventDispatcher::class));
$config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$config
->expects($this->any())
->method('getUserValue')
->willReturnArgument(3);
$config
->expects($this->any())
->method('getAppValue')
->willReturnArgument(2);
$this->userManager = new Manager($config, $this->createMock(EventDispatcherInterface::class), $this->createMock(ICacheFactory::class), $this->createMock(IEventDispatcher::class));
$userBackend = new Dummy();
$userBackend->createUser('u1', '');
$userBackend->createUser('u2', '');
Expand Down
14 changes: 13 additions & 1 deletion tests/lib/User/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,19 @@ public function testCallForSeenUsers() {
}

public function testDeleteUser() {
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->cacheFactory, $this->eventDispatcher);
$config = $this->getMockBuilder(AllConfig::class)
->disableOriginalConstructor()
->getMock();
$config
->expects($this->any())
->method('getUserValue')
->willReturnArgument(3);
$config
->expects($this->any())
->method('getAppValue')
->willReturnArgument(2);

$manager = new \OC\User\Manager($config, $this->oldDispatcher, $this->cacheFactory, $this->eventDispatcher);
$backend = new \Test\Util\User\Dummy();

$manager->registerBackend($backend);
Expand Down