From d91395848e76a4ba5bce896be3fc29cffb7c91f8 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 13:33:24 +0200 Subject: [PATCH 1/6] Upgrade to node16 in github action static.yml Signed-off-by: Cyrille Bollu --- .github/workflows/static.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9cefde2e7cd5b5a3ea9dc955c92808f1f8beee8b Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 13:39:03 +0200 Subject: [PATCH 2/6] Review compatibility matrix for PHP tests Signed-off-by: Cyrille Bollu --- .github/workflows/php-test.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 25cde39f..8e181708 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -11,13 +11,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.3', '7.4'] - nextcloud-versions: ['stable20', 'stable21', 'stable22'] - include: - - php-versions: '7.2' - nextcloud-versions: 'stable20' - - php-versions: '8' - nextcloud-versions: 'stable22' + php-versions: ['7.3', '7.4', '8'] + nextcloud-versions: ['stable25', 'stable26', 'stable27'] name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests env: CI: true From 8dec6e3eb75e86780867d3b6f931161f0c690fd8 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 13:42:48 +0200 Subject: [PATCH 3/6] Makes github action php-test run on any push or pull-request Signed-off-by: Cyrille Bollu --- .github/workflows/php-test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index 8e181708..e5c8cdc3 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -1,10 +1,6 @@ name: PHP Tests -on: - pull_request: - push: - branches: - - master +on: [push, pull_request] jobs: unit-tests: From b570180c7b2e21771b9c6c36f16e93e5f0ceefeb Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 13:44:14 +0200 Subject: [PATCH 4/6] Fixes php tests: NC25 requires at least php7.4 Signed-off-by: Cyrille Bollu --- .github/workflows/php-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index e5c8cdc3..a24f13a3 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.3', '7.4', '8'] + php-versions: ['7.4', '8'] nextcloud-versions: ['stable25', 'stable26', 'stable27'] name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests env: From 07b58fb3d51f3da7651fd79cd053a0491a2d630e Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 13:46:43 +0200 Subject: [PATCH 5/6] fix php tests again: only NC25 supports php<8 Signed-off-by: Cyrille Bollu --- .github/workflows/php-test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml index a24f13a3..c915b85a 100644 --- a/.github/workflows/php-test.yml +++ b/.github/workflows/php-test.yml @@ -7,8 +7,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.4', '8'] - nextcloud-versions: ['stable25', 'stable26', 'stable27'] + php-versions: ['8'] + nextcloud-versions: ['stable26', 'stable27'] + include: + - php-versions: '7.4' + nextcloud-versions: 'stable25' + name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests env: CI: true From d9d4a549864c02c38154500e3022d282beeba326 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 26 May 2024 14:11:01 +0200 Subject: [PATCH 6/6] Fixes PHP unit tests Signed-off-by: Cyrille Bollu --- tests/Unit/Settings/SendentSettingsTest.php | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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 ); }