diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db48512..c1763cf 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 @@ -18,7 +21,7 @@ jobs: - 33306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: project - name: Build project @@ -26,9 +29,41 @@ jobs: CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} run: | composer global require su-sws/stanford-caravan:10.x-dev - ~/.composer/vendor/bin/sws-caravan phpunit /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --with-coverage + ~/.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@v3 + uses: actions/upload-artifact@v4 + if: failure() + 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 @@ -46,7 +81,7 @@ jobs: # options: '--network-alias drupal8ci' # services: # mysql: -# image: mysql:5.7 +# image: mysql:8.0 # env: # MYSQL_DATABASE: drupal # MYSQL_USER: drupal @@ -56,15 +91,15 @@ jobs: # - 33306:3306 # options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 # steps: -# - uses: actions/checkout@v3 +# - uses: actions/checkout@v4 # with: # path: project # - name: Run tests # run: | -# composer global require su-sws/stanford-caravan:10.x-dev -# ~/.composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=acceptance +# 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@v3 +# uses: actions/upload-artifact@v4 # if: always() # with: # name: acceptance-tests-results @@ -85,7 +120,7 @@ jobs: # image: selenium/standalone-chrome # options: '--shm-size="2g"' # mysql: -# image: mysql:5.7 +# image: mysql:8.0 # env: # MYSQL_DATABASE: drupal # MYSQL_USER: drupal @@ -95,15 +130,15 @@ jobs: # - 33306:3306 # options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 # steps: -# - uses: actions/checkout@v3 +# - uses: actions/checkout@v4 # with: # path: project # - name: Run tests # run: | -# composer global require su-sws/stanford-caravan:10.x-dev -# ~/.composer/vendor/bin/sws-caravan codeception /var/www/html --extension-dir=$GITHUB_WORKSPACE/project --suites=functional +# 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@v3 +# uses: actions/upload-artifact@v4 # if: always() # with: # name: functional-tests-results diff --git a/composer.json b/composer.json index 1a14d23..274b0ef 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,7 @@ "type": "drupal-custom-module", "license": "GPL-2.0-or-later", "minimum-stability": "dev", + "prefer-stable": true, "authors": [ { "name": "Mike Decker", @@ -17,7 +18,7 @@ } ], "require": { - "drupal/core": "^9.0 || ^10.0", + "drupal/core": "^9 || ^10 || ^11", "drupal/paragraphs": "^1.1" }, "autoload-dev": { diff --git a/modules/react_paragraphs_behaviors/react_paragraphs_behaviors.info.yml b/modules/react_paragraphs_behaviors/react_paragraphs_behaviors.info.yml index 0ea414b..c18d34b 100644 --- a/modules/react_paragraphs_behaviors/react_paragraphs_behaviors.info.yml +++ b/modules/react_paragraphs_behaviors/react_paragraphs_behaviors.info.yml @@ -1,7 +1,7 @@ name: 'React Paragraphs Behaviors' type: module description: 'Provides behavior plugin interface for paragraphs and rows.' -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^9.4 || ^10 || ^11 package: 'Custom' dependencies: - react_paragraphs:react_paragraphs diff --git a/modules/react_paragraphs_behaviors/tests/src/Kernel/Plugin/paragraphs/Behavior/ReactBehaviorsTest.php b/modules/react_paragraphs_behaviors/tests/src/Kernel/Plugin/paragraphs/Behavior/ReactBehaviorsTest.php index f4398eb..bcbc0fe 100644 --- a/modules/react_paragraphs_behaviors/tests/src/Kernel/Plugin/paragraphs/Behavior/ReactBehaviorsTest.php +++ b/modules/react_paragraphs_behaviors/tests/src/Kernel/Plugin/paragraphs/Behavior/ReactBehaviorsTest.php @@ -62,7 +62,7 @@ public function testBehaviorForm() { $form_state = new FormState(); $paragraph = $this->createMock(ParagraphInterface::class); $paragraph->method('getBehaviorSetting') - ->will($this->returnCallback([$this, 'getBehaviorSettingCallback'])); + ->willReturnCallback([$this, 'getBehaviorSettingCallback']); $element = $this->paragraphType->getEnabledBehaviorPlugins()['react_paragraphs:first'] ->buildBehaviorForm($paragraph, $form, $form_state); diff --git a/react_paragraphs.info.yml b/react_paragraphs.info.yml index 0c268ef..ea13a8b 100644 --- a/react_paragraphs.info.yml +++ b/react_paragraphs.info.yml @@ -1,7 +1,7 @@ name: React Paragraphs description: 'React based paragraphs fields' type: module -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^9.4 || ^10 || ^11 version: 8.2.17 package: Paragraphs dependencies: diff --git a/tests/src/Kernel/Controller/ReactMediaLibraryTest.php b/tests/src/Kernel/Controller/ReactMediaLibraryTest.php deleted file mode 100644 index 4bd52d5..0000000 --- a/tests/src/Kernel/Controller/ReactMediaLibraryTest.php +++ /dev/null @@ -1,72 +0,0 @@ -installEntitySchema('media'); - $this->installEntitySchema('user_role'); - $this->installEntitySchema('view'); - $this->installEntitySchema('image_style'); - $this->installConfig('media_library'); - - $current_request = new Request([ - 'media_library_opener_id' => 'media_library.opener.field_widget', - 'media_library_allowed_types' => json_encode(['image']), - 'media_library_selected_type' => 'image', - 'media_library_remaining' => 1, - 'media_library_opener_parameters' => json_encode([ - 'field_widget_id' => '', - 'entity_type_id' => 'paragraph', - 'bundle' => '', - 'field_name' => '', - ]), - ]); - - $request_stack = $this->createMock(RequestStack::class); - $request_stack->method('getCurrentRequest')->willReturn($current_request); - \Drupal::getContainer()->set('request_stack', $request_stack); - } - - /** - * Test the controller response. - */ - public function testController() { - $controller = ReactMediaLibrary::create(\Drupal::getContainer()); - $response = $controller->mediaLibrary(); - $commands = $response->getCommands(); - $this->assertCount(1, $commands); - $this->assertEquals('openDialog', $commands[0]['command']); - } - -} diff --git a/tests/src/Kernel/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php b/tests/src/Kernel/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php index 45e9798..3780188 100644 --- a/tests/src/Kernel/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php +++ b/tests/src/Kernel/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php @@ -64,7 +64,7 @@ protected function getFieldConfig(){ $field_config->method('getFieldStorageDefinition')->willReturn($field_storage); $field_config->method('getSetting') - ->will($this->returnCallback([$this,'getSettingCallback'])); + ->willReturnCallback([$this,'getSettingCallback']); return $field_config; } diff --git a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/CkeditorTest.php b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/CkeditorTest.php index c84914f..61b4fe0 100644 --- a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/CkeditorTest.php +++ b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/CkeditorTest.php @@ -53,7 +53,7 @@ public function testPlugin() { * @return \PHPUnit\Framework\MockObject\MockObject * Mocked object. */ - public function getStorageCallback() { + public function getStorageCallback($type) { $filter = $this->createMock(FilterFormatInterface::class); $filter->method('label')->willReturn('Foo Bar'); diff --git a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php index 1da93a7..a24e357 100644 --- a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php +++ b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/EntityReferenceTest.php @@ -35,7 +35,7 @@ public function testPluginMediaLibrary() { /** * Entity type manager get storage callback. */ - public function getStorageCallback() { + public function getStorageCallback($type) { $media_type = $this->createMock(MediaTypeInterface::class); $media_type->method('label')->willReturn('Image'); diff --git a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ReactParagraphsFieldsTestBase.php b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ReactParagraphsFieldsTestBase.php index baea33a..74382ac 100644 --- a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ReactParagraphsFieldsTestBase.php +++ b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ReactParagraphsFieldsTestBase.php @@ -52,7 +52,7 @@ public function setup(): void { $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class); $entity_type_manager->method('getStorage') - ->will($this->returnCallback([$this, 'getStorageCallback'])); + ->willReturnCallback([$this, 'getStorageCallback']); $this->container->set('entity_type.manager', $entity_type_manager); $this->container->set('current_user', $this->createMock(AccountProxyInterface::class)); @@ -91,5 +91,6 @@ public function testPlugin() { $this->assertEquals($expected, $data); } + public function getStorageCallback($type) {} } diff --git a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/SelectTest.php b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/SelectTest.php index b79e4bc..361d649 100644 --- a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/SelectTest.php +++ b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/SelectTest.php @@ -54,7 +54,7 @@ public function testWebforms() { $this->assertEquals($expected, $data); } - public function getStorageCallback() { + public function getStorageCallback($type) { $webform_storage = $this->createMock(TestWebformEntityStorageInterface::class); $webform_storage->method('getOptions')->willReturn([]); return $webform_storage; diff --git a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ViewTest.php b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ViewTest.php index 5075947..3280c09 100644 --- a/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ViewTest.php +++ b/tests/src/Unit/Plugin/Field/ReactParagraphsFields/ViewTest.php @@ -58,7 +58,7 @@ public function testPlugin() { /** * Get View storage callback. */ - public function getStorageCallback() { + public function getStorageCallback($type) { $displays = [ 'master' => [ 'display_plugin' => 'master', diff --git a/tests/src/Unit/Plugin/rest/resource/ReactParagraphsResourceTest.php b/tests/src/Unit/Plugin/rest/resource/ReactParagraphsResourceTest.php index 11ff019..109c25f 100644 --- a/tests/src/Unit/Plugin/rest/resource/ReactParagraphsResourceTest.php +++ b/tests/src/Unit/Plugin/rest/resource/ReactParagraphsResourceTest.php @@ -47,7 +47,7 @@ public function setup(): void { $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class); $entity_type_manager->method('getDefinition')->willReturn($entity_definition); - $entity_type_manager->method('getStorage')->will($this->returnCallback([$this, 'getEntityStorageCallback'])); + $entity_type_manager->method('getStorage')->willReturnCallback([$this, 'getEntityStorageCallback']); $form = [ 'field_foo' => [], @@ -113,7 +113,7 @@ public function getEntityStorageCallback($type) { $paragraph->method('access')->willReturnReference($this->entityAccess); $entity_storage->method('create')->willReturn($paragraph); - $entity_storage->method('load')->will($this->returnCallback([$this, 'loadEntityCallback'])); + $entity_storage->method('load')->willReturnCallback([$this, 'loadEntityCallback']); return $entity_storage; }