fix(tests): Adapt tests to change of DefaultShareProvider constructor

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2024-08-12 15:15:58 +02:00 committed by backportbot[bot]
parent 798f9ee68e
commit 4f929b2635

View file

@ -82,6 +82,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
/** @var IConfig|MockObject */
protected $config;
protected IShareManager&MockObject $shareManager;
protected function setUp(): void {
$this->dbConn = \OC::$server->getDatabaseConnection();
$this->userManager = $this->createMock(IUserManager::class);
@ -93,6 +95,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults = $this->getMockBuilder(Defaults::class)->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->config = $this->createMock(IConfig::class);
$this->shareManager = $this->createMock(IShareManager::class);
$this->userManager->expects($this->any())->method('userExists')->willReturn(true);
@ -108,7 +111,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
);
}
@ -132,8 +136,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @return int
*/
private function addShareToDB($shareType, $sharedWith, $sharedBy, $shareOwner,
$itemType, $fileSource, $fileTarget, $permissions, $token, $expiration,
$parent = null) {
$itemType, $fileSource, $fileTarget, $permissions, $token, $expiration,
$parent = null) {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share');
@ -469,7 +473,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
])
->setMethods(['getShareById'])
->getMock();
@ -564,7 +569,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
])
->setMethods(['getShareById'])
->getMock();
@ -2524,7 +2530,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
);
$password = md5(time());
@ -2622,7 +2629,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
);
$u1 = $userManager->createUser('testShare1', 'test');
@ -2718,7 +2726,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
$this->config
$this->config,
$this->shareManager,
);
$u1 = $userManager->createUser('testShare1', 'test');