BundleBase.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace Test\App\AppStore\Bundles;
  7. use OC\App\AppStore\Bundles\Bundle;
  8. use OCP\IL10N;
  9. use Test\TestCase;
  10. abstract class BundleBase extends TestCase {
  11. /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
  12. protected $l10n;
  13. /** @var Bundle */
  14. protected $bundle;
  15. /** @var string */
  16. protected $bundleIdentifier;
  17. /** @var string */
  18. protected $bundleName;
  19. /** @var array */
  20. protected $bundleAppIds;
  21. protected function setUp(): void {
  22. parent::setUp();
  23. $this->l10n = $this->createMock(IL10N::class);
  24. $this->l10n->method('t')
  25. ->willReturnCallback(function ($text, $parameters = []) {
  26. return vsprintf($text, $parameters);
  27. });
  28. }
  29. public function testGetIdentifier(): void {
  30. $this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
  31. }
  32. public function testGetName(): void {
  33. $this->assertSame($this->bundleName, $this->bundle->getName());
  34. }
  35. public function testGetAppIdentifiers(): void {
  36. $this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
  37. }
  38. }