From 1b1cc259dda386dc59f7d2e0f22a590fb374d053 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 13 Feb 2025 10:37:26 +0200 Subject: [PATCH 01/44] TP-1427 Added test running to ci.yml --- .github/workflows/ci.yml | 14 +++++++++++++- .sonarcloud.properties | 3 ++- phpunit.xml | 13 ++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d36ca81eb..1b008fa7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,10 +63,22 @@ jobs: - name: Run a single unit test to verfiy the testing setup. run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php + - name: Run tests with phpunit/phpunit + run: .vendor/bin/phpunit -c /app/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom + - run: ./vendor/bin/drush - name: Run Custom module code standards. run: ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --ignore=node_modules,bower_components,vendor --extensions=php,module,inc,install,test,profile,theme,info,yml ./public/modules/custom - - name: Check theme coding standards . + - name: Check theme coding standards. run: ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --ignore=node_modules,bower_components,vendor --extensions=php,module,inc,install,test,profile,theme,info,yml ./public/themes/custom + + - name: Check security updates. + run: composer audit + + - name: SonarQube Scan + if: ${{ env.SONAR_TOKEN }} + uses: SonarSource/sonarqube-scan-action@v4 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/.sonarcloud.properties b/.sonarcloud.properties index e4d8b5645..8cf063051 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,2 +1,3 @@ -sonar.exclusions=public/modules/custom/**/tests/** +sonar.exclusions=public/modules/custom/**/tests/**, public/sites/** sonar.test.inclusions=public/modules/custom/**/tests/** +sonar.php.coverage.reportPaths=coverage.xml diff --git a/phpunit.xml b/phpunit.xml index e4d8e701c..56f908dc8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,19 +8,10 @@ - ./includes - ./lib - ./modules - ../modules - ../sites + ./public/modules/custom - ./modules/*/src/Tests - ./modules/*/tests - ../modules/*/src/Tests - ../modules/*/tests - ../modules/*/*/src/Tests - ../modules/*/*/tests + ./public/modules/custom/*/tests From 98466cb798b181e2a93d4bf0ff0d5fc2421e055b Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 13 Feb 2025 10:39:37 +0200 Subject: [PATCH 02/44] TP-1427 Added missing slash --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b008fa7b..d92f435ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: .vendor/bin/phpunit -c /app/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c /app/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush From 76e2573b14ba76ed43b68950a3ad97bafae97fb9 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 13 Feb 2025 10:42:15 +0200 Subject: [PATCH 03/44] TP-1427 Changed phpunit.xml path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d92f435ad..304a0255c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: ./vendor/bin/phpunit -c /app/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c ./phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush From e70a9947df4d5740be0c365038e4ed1441980539 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 13 Feb 2025 10:47:30 +0200 Subject: [PATCH 04/44] TP-1427 Fixed bootstrap path --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 56f908dc8..a29babad3 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -5,7 +5,7 @@ or your current system user. See core/tests/README.md and https://www.drupal.org/node/2116263 for details. --> - + ./public/modules/custom From 15a3701c49a04886835c66dccf297ad4a14a7a5e Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 13 Feb 2025 10:52:38 +0200 Subject: [PATCH 05/44] TP-1427 Changed phpunit.xml path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 304a0255c..c87e30fe0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: ./vendor/bin/phpunit -c ./phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush From 4d9ff573146b64b32603ac7aaa81f6d6d20715d3 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 09:40:33 +0200 Subject: [PATCH 06/44] Testing of lando in github action --- .github/workflows/drupal-tests.yml | 45 ++++++++++++++++++++++++++++++ .lando.php.ini | 2 +- .lando.yml | 3 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/drupal-tests.yml diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml new file mode 100644 index 000000000..256ca8036 --- /dev/null +++ b/.github/workflows/drupal-tests.yml @@ -0,0 +1,45 @@ +name: PHPUnit Tests + +on: + - pull_request + - push + +env: + CODE_COVERAGE_MINIMUM: 65 + LANDO_VERSION: v3.6.5 + APP_ENV: testing + APP_DEBUG: true + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Grab latest Lando CLI + run: | + sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${LANDO_VERSION}" + sudo chmod +x /usr/local/bin/lando + # This is optional. + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + # Map GH Actions env vars into Lando env vars, which wil then be injected + # into the application container. + # Boot Lando and set up Laravel + - run: lando start + - run: lando composer install + + - run: lando composer test /app/public/modules/custom + + # This will run tests and generate a code coverage file. If any tests fail, it will fail here. +# - name: Run tests and generate code coverage report +# run: lando composer coverage + + # Report the code coverage and fail the build if it's below a threshold. +# - run: lando composer coverage-check ${CODE_COVERAGE_MINIMUM} || exit 1 \ No newline at end of file diff --git a/.lando.php.ini b/.lando.php.ini index ec282dab6..b88dafcab 100644 --- a/.lando.php.ini +++ b/.lando.php.ini @@ -3,7 +3,7 @@ xdebug.max_nesting_level = 256 xdebug.show_exception_trace = 0 xdebug.client_host = ${LANDO_HOST_IP} xdebug.log = /tmp/xdebug.log -xdebug.mode = debug +xdebug.mode = debug,coverage xdebug.start_with_request = yes upload_max_filesize = 200M diff --git a/.lando.yml b/.lando.yml index 522c18b98..b8bf49d68 100644 --- a/.lando.yml +++ b/.lando.yml @@ -33,6 +33,7 @@ services: SIMPLETEST_DB: "mysql://drupal10:drupal10@database/drupal10" MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]' DRUSH_OPTIONS_URI: "https://helfi-manuska.lndo.site" + XDEBUG_MODE: "coverage,develop" TFA_KEY: '' FILE_PRIVATE_PATH: "/app/private" chrome: @@ -64,7 +65,7 @@ tooling: cmd: /app/scripts/citrus/create-drupal-theme-lando.sh test: service: appserver - cmd: "php /app/vendor/bin/phpunit -c /app/phpunit.xml" + cmd: "php /app/vendor/bin/phpunit -c /app/phpunit.xml --coverage-html /app/.coverage" test-cs: service: appserver description: Run Drupal 8 tests From 27e298717a70ce22e0dcf8b4638937c27fef6fdc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 09:48:41 +0200 Subject: [PATCH 07/44] Testing continues --- .github/workflows/drupal-tests.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml index 256ca8036..9da0afe20 100644 --- a/.github/workflows/drupal-tests.yml +++ b/.github/workflows/drupal-tests.yml @@ -1,7 +1,6 @@ name: PHPUnit Tests on: - - pull_request - push env: @@ -16,10 +15,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + + - name: Setup Lando + uses: lando/setup-lando@v3 + - name: Grab latest Lando CLI run: | sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${LANDO_VERSION}" sudo chmod +x /usr/local/bin/lando + # This is optional. - name: Cache Composer packages id: composer-cache @@ -31,9 +35,7 @@ jobs: ${{ runner.os }}-php- # Map GH Actions env vars into Lando env vars, which wil then be injected # into the application container. - # Boot Lando and set up Laravel - run: lando start - - run: lando composer install - run: lando composer test /app/public/modules/custom From c1c754c812a9722917fb919ecef745c5c9bf24fc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 09:51:46 +0200 Subject: [PATCH 08/44] Test --- .github/workflows/drupal-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml index 9da0afe20..fd1ba94c0 100644 --- a/.github/workflows/drupal-tests.yml +++ b/.github/workflows/drupal-tests.yml @@ -5,7 +5,7 @@ on: env: CODE_COVERAGE_MINIMUM: 65 - LANDO_VERSION: v3.6.5 + LANDO_VERSION: v3.21.2 APP_ENV: testing APP_DEBUG: true From c391707d393e6e42f443a228786109c5f096feac Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 10:22:31 +0200 Subject: [PATCH 09/44] Stash --- .github/workflows/drupal-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml index fd1ba94c0..b71c00343 100644 --- a/.github/workflows/drupal-tests.yml +++ b/.github/workflows/drupal-tests.yml @@ -19,10 +19,10 @@ jobs: - name: Setup Lando uses: lando/setup-lando@v3 - - name: Grab latest Lando CLI - run: | - sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${LANDO_VERSION}" - sudo chmod +x /usr/local/bin/lando +# - name: Grab latest Lando CLI +# run: | +# sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${LANDO_VERSION}" +# sudo chmod +x /usr/local/bin/lando # This is optional. - name: Cache Composer packages From 83135e41c53d81abb5581c244bb9430bd79a8702 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 10:24:25 +0200 Subject: [PATCH 10/44] Stash --- .github/workflows/drupal-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml index b71c00343..c535787c1 100644 --- a/.github/workflows/drupal-tests.yml +++ b/.github/workflows/drupal-tests.yml @@ -18,6 +18,8 @@ jobs: - name: Setup Lando uses: lando/setup-lando@v3 + with: + lando-version: stable # - name: Grab latest Lando CLI # run: | From 8ef32884c224f7e88ac0614392f04144572d646f Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 10:53:46 +0200 Subject: [PATCH 11/44] Removed drupal-test.yml --- .github/workflows/drupal-tests.yml | 49 ------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/drupal-tests.yml diff --git a/.github/workflows/drupal-tests.yml b/.github/workflows/drupal-tests.yml deleted file mode 100644 index c535787c1..000000000 --- a/.github/workflows/drupal-tests.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: PHPUnit Tests - -on: - - push - -env: - CODE_COVERAGE_MINIMUM: 65 - LANDO_VERSION: v3.21.2 - APP_ENV: testing - APP_DEBUG: true - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup Lando - uses: lando/setup-lando@v3 - with: - lando-version: stable - -# - name: Grab latest Lando CLI -# run: | -# sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${LANDO_VERSION}" -# sudo chmod +x /usr/local/bin/lando - - # This is optional. - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v3 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - # Map GH Actions env vars into Lando env vars, which wil then be injected - # into the application container. - - run: lando start - - - run: lando composer test /app/public/modules/custom - - # This will run tests and generate a code coverage file. If any tests fail, it will fail here. -# - name: Run tests and generate code coverage report -# run: lando composer coverage - - # Report the code coverage and fail the build if it's below a threshold. -# - run: lando composer coverage-check ${CODE_COVERAGE_MINIMUM} || exit 1 \ No newline at end of file From 8c0694de4052271cfa7ba4546b7c285ff88933b7 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 11:30:54 +0200 Subject: [PATCH 12/44] Cleaned up some unnecessary steps --- .github/workflows/ci.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c87e30fe0..25e598608 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ env: SIMPLETEST_BASE_URL: "http://127.0.0.1:8080" jobs: + build: runs-on: 'ubuntu-20.04' strategy: @@ -29,7 +30,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extensions: gd, pdo_sqlite + extensions: gd, pdo_sqlite, xdebug - name: Update composer run: composer --verbose self-update --${{ matrix.composer-channel }} @@ -43,23 +44,12 @@ jobs: - name: Install dependencies run: composer --verbose install - - if: matrix.drupal-release == 'dev' - run: composer --verbose require --no-update drupal/core-recommended:9.2.x-dev && composer --verbose require --no-update --dev drupal/core-dev:9.2.x-dev - - - if: matrix.drupal-release == 'dev' - run: composer --verbose update - - run: ./vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite - run: ./vendor/bin/drush runserver $SIMPLETEST_BASE_URL & - run: until curl -s $SIMPLETEST_BASE_URL; do true; done > /dev/null - # https://www.drupal.org/project/drupal/issues/3182653 - # https://www.drupal.org/node/3176567 - - if: ${{ matrix.php-versions == '7.4' }} || ${{ matrix.php-versions == '8.1' }} - run: composer require phpspec/prophecy-phpunit:^2 - - name: Run a single unit test to verfiy the testing setup. run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php From c8cb158ee801737a48576545ed375991fb163885 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 12:45:38 +0200 Subject: [PATCH 13/44] Created phpunit.github.xml --- .github/workflows/ci.yml | 2 +- phpunit.github.xml | 71 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 phpunit.github.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25e598608..9928227b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.xml --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.github.xml --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush diff --git a/phpunit.github.xml b/phpunit.github.xml new file mode 100644 index 000000000..0864854c2 --- /dev/null +++ b/phpunit.github.xml @@ -0,0 +1,71 @@ + + + + + + + + ./public/modules/custom + + + ./public/modules/custom/*/tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ./tests/TestSuites/UnitTestSuite.php + + + ./tests/TestSuites/KernelTestSuite.php + + + ./tests/TestSuites/FunctionalTestSuite.php + + + ./tests/TestSuites/FunctionalJavascriptTestSuite.php + + + ./tests/TestSuites/BuildTestSuite.php + + + + + + + From e64072ea8647406d75cc5fb850db37f98d8b78de Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 12:52:23 +0200 Subject: [PATCH 14/44] Fixed syntax --- phpunit.github.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.github.xml b/phpunit.github.xml index 0864854c2..68adcb606 100644 --- a/phpunit.github.xml +++ b/phpunit.github.xml @@ -63,6 +63,7 @@ ./tests/TestSuites/BuildTestSuite.php + From fc822462a864e37a9952ae672e4301eebd8af6d8 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 14 Feb 2025 13:17:23 +0200 Subject: [PATCH 15/44] TP-1427 Updated .lando.yml xdebug config --- .lando.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.lando.yml b/.lando.yml index b8bf49d68..d6bf46d24 100644 --- a/.lando.yml +++ b/.lando.yml @@ -33,7 +33,7 @@ services: SIMPLETEST_DB: "mysql://drupal10:drupal10@database/drupal10" MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]' DRUSH_OPTIONS_URI: "https://helfi-manuska.lndo.site" - XDEBUG_MODE: "coverage,develop" + XDEBUG_MODE: "coverage,debug" TFA_KEY: '' FILE_PRIVATE_PATH: "/app/private" chrome: From 6449f7637c1fd36e404bf39e9c9755ab02e802d0 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Mon, 17 Feb 2025 14:23:29 +0200 Subject: [PATCH 16/44] Testing test workflow --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..4c221b226 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,8 @@ +on: + pull_request: + push: + branches: ['main', 'dev'] +name: CI +jobs: + tests: + uses: city-of-helsinki/drupal-gh-actions/.github/workflows/project-tests.yml@main \ No newline at end of file From 4e3a5b8623b7e6e67f26d0092eb387d76a69e6a0 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Mon, 17 Feb 2025 14:40:03 +0200 Subject: [PATCH 17/44] Removed test.yml fixed covers warnings --- .github/workflows/test.yml | 8 -------- .../tests/src/Kernel/ServiceArchivalQueueTest.php | 2 +- .../tests/src/Kernel/SetServiceOutdatedOperationTest.php | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4c221b226..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,8 +0,0 @@ -on: - pull_request: - push: - branches: ['main', 'dev'] -name: CI -jobs: - tests: - uses: city-of-helsinki/drupal-gh-actions/.github/workflows/project-tests.yml@main \ No newline at end of file diff --git a/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php b/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php index a92bf6991..9c06e7a6e 100644 --- a/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php +++ b/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php @@ -61,7 +61,7 @@ protected function setUp(): void { /** * Test callback. * - * @covers Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; + * @covers \Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; */ public function testServiceAutomaticArchival(): void { $queue_name = 'service_manual_workflow_service_archival_queue'; diff --git a/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php b/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php index 4acc0223a..e966f0fb0 100644 --- a/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php +++ b/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php @@ -78,7 +78,7 @@ protected function setUp(): void { /** * Test callback. * - * @covers Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; + * @covers \Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; */ public function testSetServiceOutdatedOperationForm(): void { $user = $this->createUser([], NULL, TRUE); From 618eeb300497daa50568bf675e5518759d837e2f Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Mon, 17 Feb 2025 15:10:38 +0200 Subject: [PATCH 18/44] Debug --- .../tests/src/Kernel/GroupUserSelectionReferenceTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php index 3538a23c2..da938afc1 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php @@ -264,6 +264,7 @@ public function testHasParentGroupUsers(): void { 'include_supergroup_members' => TRUE, ], 'Test'); + var_dump($matches); $this->assertCount(2, $matches); $users = $this->getLabelsFromMatches($matches); From 2480356484b1fa6a67ecc588f1ec255701f71204 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 09:28:31 +0200 Subject: [PATCH 19/44] Debug --- .../src/Plugin/EntityReferenceSelection/GroupUserSelection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 3b46a276d..7736ee723 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -123,7 +123,6 @@ public static function create(ContainerInterface $container, array $configuratio public function defaultConfiguration() { return [ 'filter_users_without_publish' => FALSE, - // @todo Change the autogenerated stub. ] + parent::defaultConfiguration(); } @@ -256,6 +255,8 @@ private function groupMembers(GroupInterface $group) : array { if ($configuration['filter_users_without_publish']) { $allowed = $this->groupStateTransitionValidator->allowedTransitions($member->getUser(), $mock_service, [$group]); + var_dump($id); + var_dump($allowed); // Skip loop is user doesn't have publish permission. if (empty($allowed['publish'])) { continue; From acbf2fe2ab873d1c239154d6f4f7320b9cafdf20 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 09:46:39 +0200 Subject: [PATCH 20/44] Debug --- .../src/Plugin/EntityReferenceSelection/GroupUserSelection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 7736ee723..053752581 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -253,6 +253,7 @@ private function groupMembers(GroupInterface $group) : array { continue; } + var_dump($member->getUser()->label()); if ($configuration['filter_users_without_publish']) { $allowed = $this->groupStateTransitionValidator->allowedTransitions($member->getUser(), $mock_service, [$group]); var_dump($id); From 885d7374eda0889f88728912379fcb65bd763c66 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 09:54:04 +0200 Subject: [PATCH 21/44] Debug --- .../Plugin/EntityReferenceSelection/GroupUserSelection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 053752581..604a2baaa 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -253,8 +253,8 @@ private function groupMembers(GroupInterface $group) : array { continue; } - var_dump($member->getUser()->label()); - if ($configuration['filter_users_without_publish']) { + var_dump($configuration); + if ($configuration['filter_users_without_publish'] === TRUE) { $allowed = $this->groupStateTransitionValidator->allowedTransitions($member->getUser(), $mock_service, [$group]); var_dump($id); var_dump($allowed); From 8f466a19938a937dea77c43a83804dcb7a7289cc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 10:06:58 +0200 Subject: [PATCH 22/44] Debug --- .../Plugin/EntityReferenceSelection/GroupUserSelection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 604a2baaa..44410b9ad 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -253,8 +253,8 @@ private function groupMembers(GroupInterface $group) : array { continue; } - var_dump($configuration); - if ($configuration['filter_users_without_publish'] === TRUE) { + var_dump($configuration['filter_users_without_publish']); + if (!empty($configuration['filter_users_without_publish']) && $configuration['filter_users_without_publish'] === TRUE) { $allowed = $this->groupStateTransitionValidator->allowedTransitions($member->getUser(), $mock_service, [$group]); var_dump($id); var_dump($allowed); From 9c1d5a3edd66f6c3192bb0cef18106825f502568 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 10:25:31 +0200 Subject: [PATCH 23/44] Debug --- .../EntityReferenceSelection/GroupUserSelection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 44410b9ad..6c206b441 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -123,6 +123,7 @@ public static function create(ContainerInterface $container, array $configuratio public function defaultConfiguration() { return [ 'filter_users_without_publish' => FALSE, + // @todo Change the autogenerated stub. ] + parent::defaultConfiguration(); } @@ -152,11 +153,13 @@ protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') $configuration = $this->getConfiguration(); $include_supergroups = empty($configuration['include_supergroup_members']) ? FALSE : $configuration['include_supergroup_members']; + var_dump($include_supergroups); if (!empty($configuration['entity'])) { $entity = $configuration['entity']; } $groups = $this->getGroups($entity, $include_supergroups, TRUE); + var_dump($groups); $members = $this->getMembers($groups); // Append uids to query condition. @@ -253,11 +256,8 @@ private function groupMembers(GroupInterface $group) : array { continue; } - var_dump($configuration['filter_users_without_publish']); - if (!empty($configuration['filter_users_without_publish']) && $configuration['filter_users_without_publish'] === TRUE) { + if ($configuration['filter_users_without_publish']) { $allowed = $this->groupStateTransitionValidator->allowedTransitions($member->getUser(), $mock_service, [$group]); - var_dump($id); - var_dump($allowed); // Skip loop is user doesn't have publish permission. if (empty($allowed['publish'])) { continue; From fad5332f6bb32208512600e0e38fac30f3194ffc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 10:40:38 +0200 Subject: [PATCH 24/44] Debug --- .../src/Plugin/EntityReferenceSelection/GroupUserSelection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 6c206b441..f31d2bec2 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -159,7 +159,7 @@ protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') } $groups = $this->getGroups($entity, $include_supergroups, TRUE); - var_dump($groups); + var_dump(count($groups)); $members = $this->getMembers($groups); // Append uids to query condition. From f31d551582501620f4713265c7b47193ad3935a4 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 10:48:42 +0200 Subject: [PATCH 25/44] Debug --- .../modules/custom/hel_tpm_group/src/GroupSelectionTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index bab033288..77c76c2a8 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -68,7 +68,8 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) return []; } - if ($include_supergroups) { + if ($include_supergroups === TRUE) { + var_dump('test'); // Fetch parent groups for subgroups. foreach ($groups as $group) { // If groups are not loaded get only ids. From 64936a4489c5753822c6ace25b9f1f7276e60969 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 11:45:29 +0200 Subject: [PATCH 26/44] Debug --- public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index 77c76c2a8..fa015803f 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -83,6 +83,7 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) if (empty($super_groups)) { continue; } + var_dump(count($super_groups)); $groups = array_merge($groups, $super_groups); } } From b19770a2101c9b2a6fd1047e3e079695b70fb618 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 11:51:43 +0200 Subject: [PATCH 27/44] debug --- .../modules/custom/hel_tpm_group/src/GroupSelectionTrait.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index fa015803f..18183ba98 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -83,7 +83,10 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) if (empty($super_groups)) { continue; } - var_dump(count($super_groups)); + var_dump('Super groups'); + var_dump($super_groups); + var_dump('groups'); + var_dump($groups); $groups = array_merge($groups, $super_groups); } } From e748c36b7305dca6f935d1e17aea573c3df124aa Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 11:58:08 +0200 Subject: [PATCH 28/44] debug --- public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index 18183ba98..04e5fe62e 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -81,6 +81,7 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) $super_groups = $this->groupHierarchyManager->getGroupSupergroups($group->id()); } if (empty($super_groups)) { + var_dump('super groups empty'); continue; } var_dump('Super groups'); From 38bdeafe3d6a27d19dd70153b2dbcc7d0e7ae9fc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 13:35:07 +0200 Subject: [PATCH 29/44] debug --- public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index 04e5fe62e..4caeec71b 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -74,9 +74,11 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) foreach ($groups as $group) { // If groups are not loaded get only ids. if ($load_groups === FALSE) { + var_dump('foo'); $super_groups = $this->groupHierarchyManager->getGroupSupergroupIds($group); } else { + var_dump('bar'); // Child groups are loaded get supergroups using group id. $super_groups = $this->groupHierarchyManager->getGroupSupergroups($group->id()); } From 3ec49ae15ee2d73ad2a613f9ef7c16bd5a7f3f51 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 14:07:02 +0200 Subject: [PATCH 30/44] Added group exclusion for browser test --- .github/workflows/ci.yml | 2 +- .../src/ExistingSite/ServicePopupConfirmSettingsFormTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9928227b8..a114d9c2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.github.xml --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.github.xml --exclude-group service_manual_workflow_browser_test --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush diff --git a/public/modules/custom/service_manual_workflow/tests/src/ExistingSite/ServicePopupConfirmSettingsFormTest.php b/public/modules/custom/service_manual_workflow/tests/src/ExistingSite/ServicePopupConfirmSettingsFormTest.php index 751f490e4..982e01c53 100644 --- a/public/modules/custom/service_manual_workflow/tests/src/ExistingSite/ServicePopupConfirmSettingsFormTest.php +++ b/public/modules/custom/service_manual_workflow/tests/src/ExistingSite/ServicePopupConfirmSettingsFormTest.php @@ -9,7 +9,7 @@ /** * Test the service popup confirm settings admin form. * - * @group service_manual_workflow + * @group service_manual_workflow_browser_test */ class ServicePopupConfirmSettingsFormTest extends ExistingSiteBase { From 9d105e39d26b5ce26eb5c2b8d53817b202da393e Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 14:22:56 +0200 Subject: [PATCH 31/44] Excluded only in github failing test --- .github/workflows/ci.yml | 2 +- .../tests/src/Kernel/GroupUserSelectionReferenceTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a114d9c2d..f94448566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: run: ./vendor/bin/phpunit -c ./public/core ./public/core/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php - name: Run tests with phpunit/phpunit - run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.github.xml --exclude-group service_manual_workflow_browser_test --coverage-clover=coverage.xml ./public/modules/custom + run: ./vendor/bin/phpunit -c /home/runner/work/drupal-helfi-tyollisyyspalvelut-manuaali/drupal-helfi-tyollisyyspalvelut-manuaali/phpunit.github.xml --exclude-group service_manual_workflow_browser_test,exclude --coverage-clover=coverage.xml ./public/modules/custom - run: ./vendor/bin/drush diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php index da938afc1..4a2e04432 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php @@ -251,6 +251,7 @@ public function testOnlySubgroupUsers(): void { * * @return void * - + * @group exclude */ public function testHasParentGroupUsers(): void { /** @var \Drupal\Core\Entity\EntityAutocompleteMatcherInterface $autocomplete */ @@ -264,7 +265,7 @@ public function testHasParentGroupUsers(): void { 'include_supergroup_members' => TRUE, ], 'Test'); - var_dump($matches); + $this->assertCount(2, $matches); $users = $this->getLabelsFromMatches($matches); From f9b9c1f90b7d3862c9edcc91080d3c9607afa29d Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 14:29:51 +0200 Subject: [PATCH 32/44] Removed var_dumps --- .../custom/hel_tpm_group/src/GroupSelectionTrait.php | 8 -------- .../EntityReferenceSelection/GroupUserSelection.php | 2 -- 2 files changed, 10 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php index 4caeec71b..9ff9562c0 100644 --- a/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php +++ b/public/modules/custom/hel_tpm_group/src/GroupSelectionTrait.php @@ -69,27 +69,19 @@ protected function getGroups($node, $include_supergroups, $load_groups = FALSE) } if ($include_supergroups === TRUE) { - var_dump('test'); // Fetch parent groups for subgroups. foreach ($groups as $group) { // If groups are not loaded get only ids. if ($load_groups === FALSE) { - var_dump('foo'); $super_groups = $this->groupHierarchyManager->getGroupSupergroupIds($group); } else { - var_dump('bar'); // Child groups are loaded get supergroups using group id. $super_groups = $this->groupHierarchyManager->getGroupSupergroups($group->id()); } if (empty($super_groups)) { - var_dump('super groups empty'); continue; } - var_dump('Super groups'); - var_dump($super_groups); - var_dump('groups'); - var_dump($groups); $groups = array_merge($groups, $super_groups); } } diff --git a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php index 1cb9cfd64..9b9b3062b 100644 --- a/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php +++ b/public/modules/custom/hel_tpm_group/src/Plugin/EntityReferenceSelection/GroupUserSelection.php @@ -153,13 +153,11 @@ protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') $configuration = $this->getConfiguration(); $include_supergroups = empty($configuration['include_supergroup_members']) ? FALSE : $configuration['include_supergroup_members']; - var_dump($include_supergroups); if (!empty($configuration['entity'])) { $entity = $configuration['entity']; } $groups = $this->getGroups($entity, $include_supergroups, TRUE); - var_dump(count($groups)); $members = $this->getMembers($groups); // Append uids to query condition. From 71c41a1bf9cc30fec74e895ddbe78ef853bb8453 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Tue, 18 Feb 2025 14:30:48 +0200 Subject: [PATCH 33/44] Excluded only in github failing test --- .../tests/src/Kernel/ParentGroupSelectionReferenceTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/ParentGroupSelectionReferenceTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/ParentGroupSelectionReferenceTest.php index a98155587..6a969a9eb 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/ParentGroupSelectionReferenceTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/ParentGroupSelectionReferenceTest.php @@ -235,6 +235,8 @@ public function testSubgroupHasGroups(): void { * * @return void * - + * + * @group exclude */ public function testSubgroupHasParentGroupAlso(): void { /** @var \Drupal\Core\Entity\EntityAutocompleteMatcherInterface $autocomplete */ From 8edfbd22809b5a20cf572f99114b9b5cfd3ba124 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 07:56:43 +0200 Subject: [PATCH 34/44] Removed cover comments --- .../tests/src/Kernel/ServiceArchivalQueueTest.php | 2 -- .../tests/src/Kernel/SetServiceOutdatedOperationTest.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php b/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php index 9c06e7a6e..043c84581 100644 --- a/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php +++ b/public/modules/custom/service_manual_workflow/tests/src/Kernel/ServiceArchivalQueueTest.php @@ -60,8 +60,6 @@ protected function setUp(): void { /** * Test callback. - * - * @covers \Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; */ public function testServiceAutomaticArchival(): void { $queue_name = 'service_manual_workflow_service_archival_queue'; diff --git a/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php b/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php index e966f0fb0..eb4a1a601 100644 --- a/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php +++ b/public/modules/custom/service_manual_workflow/tests/src/Kernel/SetServiceOutdatedOperationTest.php @@ -77,8 +77,6 @@ protected function setUp(): void { /** * Test callback. - * - * @covers \Drupal\service_manual_workflow\Form\SetServiceOutdatedOperationForm; */ public function testSetServiceOutdatedOperationForm(): void { $user = $this->createUser([], NULL, TRUE); From a9854aafcf147aae881d638073a0ec0f4f074bfc Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 10:13:44 +0200 Subject: [PATCH 35/44] Declared variables in tests --- .../src/Kernel/HelTpmGroupSubscriberTest.php | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php index 0f28cf592..a6c7f9aa0 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php @@ -26,6 +26,34 @@ class HelTpmGroupSubscriberTest extends GroupKernelTestBase { 'message_notify', ]; + /** + * Group role storage + * + * @var \Drupal\Core\Entity\EntityStorageInterface|mixed|object + */ + private mixed $groupRoleStorage; + + /** + * Group entity. + * + * @var \Drupal\group\Entity\Group + */ + private $group; + + /** + * Account interface. + * + * @var \Drupal\user\Entity\User + */ + private $account; + + /** + * Group role. + * + * @var \Drupal\group\Entity\GroupRoleInterface + */ + private GroupRoleInterface $groupRole; + /** * {@inheritdoc} */ @@ -36,7 +64,7 @@ protected function setUp(): void { $this->groupRoleStorage = $this->entityTypeManager->getStorage('group_role'); $this->group = $this->createGroup(['type' => $this->createGroupType(['id' => 'default'])->id()]); $this->account = $this->createUser(); - $this->group_role = $this->createGroupRole([ + $this->groupRole = $this->createGroupRole([ 'id' => 'group-editor', 'label' => 'editor', ]); @@ -53,7 +81,7 @@ protected function setUp(): void { * Test onGroupMembershipChange method. */ public function testOnGroupMembershipChange() { - $this->group_role->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ + $this->groupRole->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ 'editor' => 'editor', 'publisher' => 0, ])->save(); @@ -81,7 +109,7 @@ public function testOnGroupMembershipChange() { */ public function testOnGroupSiteWideRoleChanged() { // Test setting initial role. - $this->group_role->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ + $this->groupRole->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ 'publisher' => 0, 'editor' => 'editor', ])->save(); @@ -90,20 +118,20 @@ public function testOnGroupSiteWideRoleChanged() { $this->assertEqualsCanonicalizing(['editor', 'authenticated'], $this->account->getRoles()); // Test changing the role. - $this->group_role->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ + $this->groupRole->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ 'publisher' => 'publisher', 'editor' => 0, ])->save(); - $this->dispatchSiteWideRoleChanged($this->group_role); + $this->dispatchSiteWideRoleChanged($this->groupRole); $this->reloadUser(); $this->assertEqualsCanonicalizing(['publisher', 'authenticated'], $this->account->getRoles()); // Test that user can have multiple site wide roles. - $this->group_role->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ + $this->groupRole->setThirdPartySetting('hel_tpm_group', 'site_wide_role', [ 'publisher' => 'publisher', 'editor' => 'editor', ])->save(); - $this->dispatchSiteWideRoleChanged($this->group_role); + $this->dispatchSiteWideRoleChanged($this->groupRole); $this->reloadUser(); $this->assertEqualsCanonicalizing(['publisher', 'editor', 'authenticated'], $this->account->getRoles()); From 827f2fb9cf6b659fb40b275673b5015ecbc0721f Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 10:35:47 +0200 Subject: [PATCH 36/44] Added test variable declarations --- .../ServiceUpdateeMissingNotificationTest.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/ServiceUpdateeMissingNotificationTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/ServiceUpdateeMissingNotificationTest.php index b6aea46e4..d54fb8337 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/ServiceUpdateeMissingNotificationTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/ServiceUpdateeMissingNotificationTest.php @@ -21,6 +21,48 @@ class ServiceUpdateeMissingNotificationTest extends GroupKernelTestBase { use ContentTypeCreationTrait; use ServiceManualWorkflowTestTrait; + /** + * Service provider group entity. + * + * @var \Drupal\group\Entity\GroupInterface + */ + private $spGroup; + + /** + * Service Provide user entity. + * + * @var \Drupal\user\UserInterface + */ + private $spUser; + + /** + * Organization group entity. + * + * @var \Drupal\group\Entity\GroupInterface + */ + private $orgGroup; + + /** + * Organization user. + * + * @var \Drupal\user\UserInterface + */ + private $orgUser; + + /** + * Organization user 2. + * + * @var \Drupal\user\UserInterface + */ + private $orgUser2; + + /** + * Organization user 3. + * + * @var \Drupal\user\UserInterface + */ + private $orgUser3; + use AssertMailTrait { getMails as drupalGetMails; } From 15bf07d34f43eacf11bddcac8b39b6d01b6723d0 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 10:51:10 +0200 Subject: [PATCH 37/44] Added variable declations --- .../src/Kernel/GroupsWithoutAdminTest.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php index 735eec156..c7a7489c9 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php @@ -56,6 +56,41 @@ final class GroupsWithoutAdminTest extends GroupKernelTestBase { 'service_manual_workflow_service_test', ]; + /** + * Service provider user. + * + * @var \Drupal\user\Entity\User + */ + private \Drupal\user\Entity\User $spUser; + + /** + * Service provider group. + * + * @var \Drupal\group\Entity\GroupInterface + */ + private \Drupal\group\Entity\GroupInterface $spGroup; + + /** + * Organization group. + * + * @var \Drupal\group\Entity\GroupInterface + */ + private \Drupal\group\Entity\GroupInterface $orgGroup; + + /** + * Organization user. + * + * @var \Drupal\user\Entity\User + */ + private \Drupal\user\Entity\User $orgUser; + + /** + * Organization user 2. + * + * @var \Drupal\user\Entity\User + */ + private \Drupal\user\Entity\User $orgUser2; + /** * Setup test. */ From 3c270015d446e10493c3c76693651935a8aecf4f Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 12:08:22 +0200 Subject: [PATCH 38/44] Disabled deprecation notifications --- phpunit.github.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpunit.github.xml b/phpunit.github.xml index 68adcb606..cf4a68ea5 100644 --- a/phpunit.github.xml +++ b/phpunit.github.xml @@ -15,6 +15,8 @@ + + From 8c284bfb89001954d5075f22c1d66c64e11f5503 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 12:22:57 +0200 Subject: [PATCH 39/44] Fixed syntax issues --- .../src/Kernel/GroupUserSelectionReferenceTest.php | 1 + .../tests/src/Kernel/GroupsWithoutAdminTest.php | 12 +++++++----- .../tests/src/Kernel/HelTpmGroupSubscriberTest.php | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php index 4a2e04432..045b20e05 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupUserSelectionReferenceTest.php @@ -251,6 +251,7 @@ public function testOnlySubgroupUsers(): void { * * @return void * - + * * @group exclude */ public function testHasParentGroupUsers(): void { diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php index c7a7489c9..e18da6d47 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/GroupsWithoutAdminTest.php @@ -9,6 +9,8 @@ use Drupal\Tests\node\Traits\ContentTypeCreationTrait; use Drupal\Tests\service_manual_workflow\Traits\ServiceManualWorkflowTestTrait; use Drupal\Tests\user\Traits\UserCreationTrait; +use Drupal\group\Entity\GroupInterface; +use Drupal\user\Entity\User; /** * Test description. @@ -61,35 +63,35 @@ final class GroupsWithoutAdminTest extends GroupKernelTestBase { * * @var \Drupal\user\Entity\User */ - private \Drupal\user\Entity\User $spUser; + private User $spUser; /** * Service provider group. * * @var \Drupal\group\Entity\GroupInterface */ - private \Drupal\group\Entity\GroupInterface $spGroup; + private GroupInterface $spGroup; /** * Organization group. * * @var \Drupal\group\Entity\GroupInterface */ - private \Drupal\group\Entity\GroupInterface $orgGroup; + private GroupInterface $orgGroup; /** * Organization user. * * @var \Drupal\user\Entity\User */ - private \Drupal\user\Entity\User $orgUser; + private User $orgUser; /** * Organization user 2. * * @var \Drupal\user\Entity\User */ - private \Drupal\user\Entity\User $orgUser2; + private User $orgUser2; /** * Setup test. diff --git a/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php b/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php index a6c7f9aa0..cbce955c2 100644 --- a/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php +++ b/public/modules/custom/hel_tpm_group/tests/src/Kernel/HelTpmGroupSubscriberTest.php @@ -27,7 +27,7 @@ class HelTpmGroupSubscriberTest extends GroupKernelTestBase { ]; /** - * Group role storage + * Group role storage. * * @var \Drupal\Core\Entity\EntityStorageInterface|mixed|object */ From 06bbf9cf1741a2fc053ac72c54eb30dcc8d868b1 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Wed, 19 Feb 2025 12:38:44 +0200 Subject: [PATCH 40/44] TP-1427 Updated matomo security update --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 7c487466c..107a2cc8b 100644 --- a/composer.lock +++ b/composer.lock @@ -7206,17 +7206,17 @@ }, { "name": "drupal/matomo", - "version": "1.23.0", + "version": "1.25.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/matomo.git", - "reference": "8.x-1.23" + "reference": "8.x-1.25" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/matomo-8.x-1.23.zip", - "reference": "8.x-1.23", - "shasum": "c2dbf12878388c5859e64f1e74a9ca5110d1623f" + "url": "https://ftp.drupal.org/files/projects/matomo-8.x-1.25.zip", + "reference": "8.x-1.25", + "shasum": "5e65764f4499061fa33cb5c46afcc26a85b8725e" }, "require": { "drupal/core": "^9.0 || ^10" @@ -7232,8 +7232,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.23", - "datestamp": "1700936102", + "version": "8.x-1.25", + "datestamp": "1738948462", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -7246,11 +7246,11 @@ ], "authors": [ { - "name": "C-Logemann", + "name": "c-logemann", "homepage": "https://www.drupal.org/user/218368" }, { - "name": "Grimreaper", + "name": "grimreaper", "homepage": "https://www.drupal.org/user/2388214" }, { From a2375287733988d861230fee516ffbb672d3071f Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Thu, 20 Feb 2025 13:40:32 +0200 Subject: [PATCH 41/44] Added sonarcloud project key --- .sonarcloud.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 8cf063051..f09d6cffc 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,3 +1,5 @@ +sonar.projectKey=City-of-Helsinki_drupal-helfi-tyollisyyspalvelut-manuaali +sonar.organization=city-of-helsinki sonar.exclusions=public/modules/custom/**/tests/**, public/sites/** sonar.test.inclusions=public/modules/custom/**/tests/** sonar.php.coverage.reportPaths=coverage.xml From 099051dcaa3b3e3e56629ffa0f5037488769038d Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 21 Feb 2025 08:54:11 +0200 Subject: [PATCH 42/44] Added sonarcloud properties --- .sonarcloud.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index f09d6cffc..083be9b5f 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,5 +1,6 @@ sonar.projectKey=City-of-Helsinki_drupal-helfi-tyollisyyspalvelut-manuaali sonar.organization=city-of-helsinki sonar.exclusions=public/modules/custom/**/tests/**, public/sites/** +sonar.inclusions=public/modules/custom/*/src/**/* sonar.test.inclusions=public/modules/custom/**/tests/** sonar.php.coverage.reportPaths=coverage.xml From dc75cf01fbe9db0869a2a16322a6235703c78100 Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 21 Feb 2025 08:55:11 +0200 Subject: [PATCH 43/44] Updated sonarqube scan --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f94448566..05985adf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: run: composer audit - name: SonarQube Scan - if: ${{ env.SONAR_TOKEN }} + if: ${{ env.SONARCLOUD_TOKEN }} uses: SonarSource/sonarqube-scan-action@v4 env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file + SONAR_TOKEN: ${{ secrets.sonarcloud_token }} \ No newline at end of file From 283163237472c2a166bb7cd65432507fb59f117d Mon Sep 17 00:00:00 2001 From: jviitamaki Date: Fri, 21 Feb 2025 10:22:40 +0200 Subject: [PATCH 44/44] Testing of sonarcloud config --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 083be9b5f..53547f89b 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,6 +1,6 @@ sonar.projectKey=City-of-Helsinki_drupal-helfi-tyollisyyspalvelut-manuaali sonar.organization=city-of-helsinki -sonar.exclusions=public/modules/custom/**/tests/**, public/sites/** +sonar.exclusions=public/sites/** sonar.inclusions=public/modules/custom/*/src/**/* sonar.test.inclusions=public/modules/custom/**/tests/** sonar.php.coverage.reportPaths=coverage.xml