BundleBase.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. namespace Test\App\AppStore\Bundles;
  22. use OC\App\AppStore\Bundles\Bundle;
  23. use OCP\IL10N;
  24. use Test\TestCase;
  25. abstract class BundleBase extends TestCase {
  26. /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
  27. protected $l10n;
  28. /** @var Bundle */
  29. protected $bundle;
  30. /** @var string */
  31. protected $bundleIdentifier;
  32. /** @var string */
  33. protected $bundleName;
  34. /** @var array */
  35. protected $bundleAppIds;
  36. public function setUp() {
  37. parent::setUp();
  38. $this->l10n = $this->createMock(IL10N::class);
  39. $this->l10n->method('t')
  40. ->will($this->returnCallback(function ($text, $parameters = []) {
  41. return vsprintf($text, $parameters);
  42. }));
  43. }
  44. public function testGetIdentifier() {
  45. $this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
  46. }
  47. public function testGetName() {
  48. $this->assertSame($this->bundleName, $this->bundle->getName());
  49. }
  50. public function testGetAppIdentifiers() {
  51. $this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
  52. }
  53. }