From ba100d01df921b9e7a471b6683ddf79a1fcd8788 Mon Sep 17 00:00:00 2001 From: pookmish Date: Thu, 29 Aug 2024 13:00:49 -0700 Subject: [PATCH] Run tests on Drupal 11 (#18) --- .github/workflows/tests.yml | 122 +++++++++++++++++- composer.json | 1 + tests/src/Kernel/StanfordSamlAuthTestBase.php | 1 + tests/src/Unit/Service/WorkgroupApiTest.php | 2 +- 4 files changed, 119 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9030c5b..1411aab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,14 +1,17 @@ name: PHPUnit and Acceptance Tests on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: phpunit: name: PHPUnit Coverage Tests runs-on: ubuntu-latest container: - image: pookmish/drupal8ci:latest + image: pookmish/drupal8ci:php8.3 services: mysql: - image: mysql:5.7 + image: mysql:8.0 env: MYSQL_DATABASE: drupal MYSQL_USER: drupal @@ -33,6 +36,38 @@ jobs: with: name: unit-tests-results path: /var/www/html/artifacts + phpunit_d11: + name: PHPUnit Coverage Tests Drupal 11 + runs-on: ubuntu-latest + container: + image: pookmish/drupal8ci:php8.3 + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: drupal + MYSQL_USER: drupal + MYSQL_PASSWORD: drupal + MYSQL_ROOT_PASSWORD: drupal + ports: + - 33306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + with: + path: project + - name: Build project + env: + CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} + run: | + composer global require su-sws/stanford-caravan:11.x-dev + ~/.config/composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage + - name: Save Test Results + uses: actions/upload-artifact@v4 + if: failure() + with: + name: unit-tests-results + path: /var/www/html/artifacts acceptance: name: Codeception Acceptance Tests runs-on: ubuntu-latest @@ -42,11 +77,11 @@ jobs: DRUPAL_DATABASE_PASSWORD: drupal DRUPAL_DATABASE_HOST: mysql container: - image: pookmish/drupal8ci:latest + image: pookmish/drupal8ci:php8.3 options: '--network-alias drupal8ci' services: mysql: - image: mysql:5.7 + image: mysql:8.0 env: MYSQL_DATABASE: drupal MYSQL_USER: drupal @@ -78,14 +113,14 @@ jobs: DRUPAL_DATABASE_PASSWORD: drupal DRUPAL_DATABASE_HOST: mysql container: - image: pookmish/drupal8ci:latest + image: pookmish/drupal8ci:php8.3 options: '--network-alias=drupal8ci' services: selenium: image: selenium/standalone-chrome options: '--shm-size="2g"' mysql: - image: mysql:5.7 + image: mysql:8.0 env: MYSQL_DATABASE: drupal MYSQL_USER: drupal @@ -108,3 +143,78 @@ jobs: with: name: functional-tests-results path: /var/www/html/artifacts + acceptance_d11: + name: Codeception Acceptance Tests Drupal 11 + runs-on: ubuntu-latest + env: + DRUPAL_DATABASE_NAME: drupal + DRUPAL_DATABASE_USERNAME: drupal + DRUPAL_DATABASE_PASSWORD: drupal + DRUPAL_DATABASE_HOST: mysql + container: + image: pookmish/drupal8ci:php8.3 + options: '--network-alias drupal8ci' + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: drupal + MYSQL_USER: drupal + MYSQL_PASSWORD: drupal + MYSQL_ROOT_PASSWORD: drupal + ports: + - 33306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + with: + path: project + - name: Run tests + run: | + composer global require su-sws/stanford-caravan:11.x-dev + ~/.config/composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=acceptance + - name: Save Test Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: acceptance-tests-results + path: /var/www/html/artifacts + functional_d11: + name: Codeception Functional Tests Drupal 11 + runs-on: ubuntu-latest + env: + DRUPAL_DATABASE_NAME: drupal + DRUPAL_DATABASE_USERNAME: drupal + DRUPAL_DATABASE_PASSWORD: drupal + DRUPAL_DATABASE_HOST: mysql + container: + image: pookmish/drupal8ci:php8.3 + options: '--network-alias=drupal8ci' + services: + selenium: + image: selenium/standalone-chrome + options: '--shm-size="2g"' + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: drupal + MYSQL_USER: drupal + MYSQL_PASSWORD: drupal + MYSQL_ROOT_PASSWORD: drupal + ports: + - 33306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - uses: actions/checkout@v4 + with: + path: project + - name: Run tests + run: | + composer global require su-sws/stanford-caravan:11.x-dev + ~/.config/composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=functional + - name: Save Test Results + uses: actions/upload-artifact@v4 + if: always() + with: + name: functional-tests-results + path: /var/www/html/artifacts diff --git a/composer.json b/composer.json index 3e46bc6..e7a2883 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "require": { "php": ">=8.1", "drupal/autologout": "^1 || ^2", + "drupal/core": "^10 || ^11", "drupal/r4032login": "^2", "drupal/samlauth": "^3" }, diff --git a/tests/src/Kernel/StanfordSamlAuthTestBase.php b/tests/src/Kernel/StanfordSamlAuthTestBase.php index 55596eb..c39b8c9 100644 --- a/tests/src/Kernel/StanfordSamlAuthTestBase.php +++ b/tests/src/Kernel/StanfordSamlAuthTestBase.php @@ -30,6 +30,7 @@ public function setup(): void { $this->installEntitySchema('user'); $this->installEntitySchema('user_role'); + $this->installEntitySchema('path_alias'); $this->installSchema('externalauth', 'authmap'); $this->installSchema('system', ['sequences']); $this->installConfig(['stanford_samlauth']); diff --git a/tests/src/Unit/Service/WorkgroupApiTest.php b/tests/src/Unit/Service/WorkgroupApiTest.php index 0d3b257..b69cad4 100644 --- a/tests/src/Unit/Service/WorkgroupApiTest.php +++ b/tests/src/Unit/Service/WorkgroupApiTest.php @@ -64,7 +64,7 @@ public function setup(): void { $guzzle = $this->createMock(ClientInterface::class); $guzzle->method('request') ->withAnyParameters() - ->will($this->returnCallback([$this, 'guzzleRequestCallback'])); + ->willReturnCallback([$this, 'guzzleRequestCallback']); $logger = $this->createMock(LoggerChannelFactoryInterface::class); $logger->method('get')