2017-04-25 17:36:59 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2025-09-29 06:34:49 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2017-04-25 17:36:59 -04:00
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-04-25 17:36:59 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Test\App\AppStore\Bundles;
|
|
|
|
|
|
|
|
|
|
use OC\App\AppStore\Bundles\Bundle;
|
|
|
|
|
use OCP\IL10N;
|
2025-09-29 06:34:49 -04:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2017-04-25 17:36:59 -04:00
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
|
|
abstract class BundleBase extends TestCase {
|
2025-09-29 06:34:49 -04:00
|
|
|
protected IL10N&MockObject $l10n;
|
|
|
|
|
protected Bundle $bundle;
|
|
|
|
|
protected string $bundleIdentifier;
|
|
|
|
|
protected string $bundleName;
|
|
|
|
|
protected array $bundleAppIds;
|
2017-04-25 17:36:59 -04:00
|
|
|
|
2019-11-27 09:27:18 -05:00
|
|
|
protected function setUp(): void {
|
2017-04-25 17:36:59 -04:00
|
|
|
parent::setUp();
|
|
|
|
|
$this->l10n = $this->createMock(IL10N::class);
|
|
|
|
|
$this->l10n->method('t')
|
2020-03-25 17:21:27 -04:00
|
|
|
->willReturnCallback(function ($text, $parameters = []) {
|
2017-04-25 17:36:59 -04:00
|
|
|
return vsprintf($text, $parameters);
|
2020-03-25 17:21:27 -04:00
|
|
|
});
|
2017-04-25 17:36:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetIdentifier(): void {
|
|
|
|
|
$this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetName(): void {
|
|
|
|
|
$this->assertSame($this->bundleName, $this->bundle->getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetAppIdentifiers(): void {
|
|
|
|
|
$this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
|
|
|
|
|
}
|
|
|
|
|
}
|