diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 25cde39f..c915b85a 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -1,23 +1,18 @@ name: PHP Tests -on: - pull_request: - push: - branches: - - master +on: [push, pull_request] jobs: unit-tests: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.3', '7.4'] - nextcloud-versions: ['stable20', 'stable21', 'stable22'] + php-versions: ['8'] + nextcloud-versions: ['stable26', 'stable27'] include: - - php-versions: '7.2' - nextcloud-versions: 'stable20' - - php-versions: '8' - nextcloud-versions: 'stable22' + - php-versions: '7.4' + nextcloud-versions: 'stable25' + name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests env: CI: true diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index a6168e5a..6c13ea88 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@master - uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Install dependencies run: yarn install - name: Build bundle diff --git a/tests/Unit/Settings/SendentSettingsTest.php b/tests/Unit/Settings/SendentSettingsTest.php index 02a74793..00ce671f 100644 --- a/tests/Unit/Settings/SendentSettingsTest.php +++ b/tests/Unit/Settings/SendentSettingsTest.php @@ -4,11 +4,14 @@ use OCA\Sendent\Constants; use OCA\Sendent\Settings\SendentSettings; +use OCA\Sendent\Service\LicenseManager; +use OCA\Sendent\Service\LicenseService; use OCP\App\IAppManager; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; use OCP\IGroupManager; +use OCP\IL10N; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\TagNotFoundException; use PHPUnit\Framework\MockObject\MockObject; @@ -27,6 +30,15 @@ class SendentSettingsTest extends TestCase { /** @var MockObject */ private $tagManager; + /** @var MockObject */ + private $l; + + /** @var MockObject */ + private $licenseManager; + + /** @var MockObject */ + private $licenseService; + /** @var SendentSettings */ private $settings; @@ -41,13 +53,28 @@ public function setUp(): void { $this->appConfig = $this->getMockBuilder(IAppConfig::class)->getMock(); /** @var ISystemTagManager */ $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)->getMock(); + /** @var IL10N */ + $this->l = $this->getMockBuilder(IL10N::class)->getMock(); + /** @var LicenseManager */ + $this->licenseManager = $this->getMockBuilder(LicenseManager::class) + ->disableOriginalConstructor() + ->getMock(); + /** @var LicenseService */ + $this->licenseService = $this->getMockBuilder(LicenseService::class) + ->disableOriginalConstructor() + ->getMock(); + $this->licenseService->method('findByGroup') + ->willReturn([]); $this->settings = new SendentSettings( $this->appManager, $this->groupManager, $this->initialState, $this->appConfig, - $this->tagManager + $this->tagManager, + $this->l, + $this->licenseManager, + $this->licenseService ); }