aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/App/AppStore/Bundles/BundleBase.php
blob: 4c31c49cdb17fcebcd37d5c03dda1e78d64a4bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
 * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace Test\App\AppStore\Bundles;

use OC\App\AppStore\Bundles\Bundle;
use OCP\IL10N;
use Test\TestCase;

abstract class BundleBase extends TestCase {
	/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
	protected $l10n;
	/** @var Bundle */
	protected $bundle;
	/** @var string */
	protected $bundleIdentifier;
	/** @var string */
	protected $bundleName;
	/** @var array */
	protected $bundleAppIds;

	protected function setUp(): void {
		parent::setUp();
		$this->l10n = $this->createMock(IL10N::class);
		$this->l10n->method('t')
			->willReturnCallback(function ($text, $parameters = []) {
				return vsprintf($text, $parameters);
			});
	}

	public function testGetIdentifier() {
		$this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
	}

	public function testGetName() {
		$this->assertSame($this->bundleName, $this->bundle->getName());
	}

	public function testGetAppIdentifiers() {
		$this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
	}
}