Skip to content

Commit

Permalink
Merge branch '7.3.x' into test-multi-module-install
Browse files Browse the repository at this point in the history
  • Loading branch information
chrfritsch authored Oct 14, 2024
2 parents b98154c + e7089fa commit dae2726
Show file tree
Hide file tree
Showing 30 changed files with 4,231 additions and 4,096 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
env:
DRUPAL_TESTING_COMPOSER_PROJECT: thunder/thunder-project
DRUPAL_TESTING_COMPOSER_PROJECT_VERSION: "^4.0@stable"
DRUPAL_TESTING_CLEANUP: false
DRUPAL_TESTING_DATABASE_USER: root
DRUPAL_TESTING_DATABASE_PASSWORD: root
DRUPAL_TESTING_TEST_DUMP_FILE: site-dump.tar.gz
Expand All @@ -28,6 +29,7 @@ env:
DRUPAL_TESTING_PARALLEL_TESTING: false
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://127.0.0.1:9515"]'
SIMPLETEST_BASE_URL: http://thunder-testing:8888
BROWSERTEST_OUTPUT_DIRECTORY: /tmp
SKIP_TEST_CLEANUP: true
# The following variable set the version that the upgrade test starts with.
DRUPAL_TESTING_UPGRADE_COMPOSER_PROJECT_VERSION: 3.0.12
Expand Down Expand Up @@ -98,7 +100,7 @@ jobs:
run: cd /tmp/test; tar cfz build-${{ matrix.PHP_VERSION }}.tgz thunder; mv build-${{ matrix.PHP_VERSION }}.tgz ${GITHUB_WORKSPACE}

- name: Upload build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.PHP_VERSION }}
path: build-${{ matrix.PHP_VERSION }}.tgz
Expand Down Expand Up @@ -148,12 +150,12 @@ jobs:
composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION}
- name: Download build
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.PHP_VERSION }}

- name: Unzip build artifact
run: mkdir -p /tmp/test; tar xCfz /tmp/test build-${{ matrix.PHP_VERSION }}/build-${{ matrix.PHP_VERSION }}.tgz thunder; rm -rf build-${{ matrix.PHP_VERSION }}
run: mkdir -p /tmp/test; tar xCfz /tmp/test build-${{ matrix.PHP_VERSION }}.tgz thunder; rm -rf build-${{ matrix.PHP_VERSION }}

- name: Setup Apache
uses: thunder/apache-shiva-php-action@v1
Expand All @@ -168,6 +170,13 @@ jobs:
THUNDER_TEST_CHUNK: ${{ matrix.CHUNK }}
DRUPAL_TESTING_TEST_PATH: /tmp/test/thunder/install/docroot/profiles/contrib/thunder/tests/src/TestSuites/ThunderTestSuite.php

- name: Upload test output
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: text-max-output-${{ matrix.CHUNK }}-${{ matrix.PHP_VERSION }}
path: /tmp/test/thunder/install/docroot/sites/simpletest/browser_output/

test-upgrade:

runs-on: ubuntu-24.04
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [7.3.6](https://github.com/thunder/thunder-distribution/tree/7.3.6) 2024-10-04

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.5...7.3.6)

Update diff module to 1.8

## [7.3.5](https://github.com/thunder/thunder-distribution/tree/7.3.5) 2024-09-24

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.3...7.3.5)

Allow scheduler version ^3.0 in composer.json

## [7.3.3](https://github.com/thunder/thunder-distribution/tree/7.3.3) 2024-08-22

[Full Changelog](https://github.com/thunder/thunder-distribution/compare/7.3.2...7.3.3)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"drupal/content_lock": "^2.1",
"drupal/crop": "^2.2",
"drupal/default_content": "^1.0-alpha7||^2.0@ALPHA",
"drupal/diff": "1.7",
"drupal/diff": "1.8",
"drupal/dropzonejs": "^2.8",
"drupal/empty_fields": "^1.0-alpha1",
"drupal/entity_reference_actions": "^1.1.1",
Expand Down Expand Up @@ -97,7 +97,7 @@
"drupal/responsive_preview": "^2.1",
"drupal/redirect": "^1.7",
"drupal/scheduler": "^2.0.2",
"drupal/scheduler_content_moderation_integration": "^2.0",
"drupal/scheduler_content_moderation_integration": "^2.0||^3.0",
"drupal/schema_metatag": "^2.4",
"drupal/select2": "^1.7",
"drupal/search_api_mark_outdated": "^1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getDescription(): TranslatableMarkup {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL): array {
public function buildForm(array $form, FormStateInterface $form_state, ?NodeInterface $node = NULL): array {
$this->revision = $node;
return parent::buildForm($form, $form_state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ protected function query(
$query->range($offset, $limit);

$storage = $this->entityTypeManager->getStorage($type);
$cacheContext->addCacheableDependency($storage->getEntityType());
$entityType = $storage->getEntityType();

$cacheContext->addCacheTags($entityType->getListCacheTags());
$cacheContext->addCacheContexts($entityType->getListCacheContexts());
return $query;
}

Expand Down
2 changes: 1 addition & 1 deletion modules/thunder_gqls/src/Traits/ResolverHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function createResolverBuilder(): void {
* @return \Drupal\graphql\GraphQL\Resolver\Composite
* The field data producer.
*/
public function fromEntityReference(string $field, ResolverInterface $entity = NULL, bool $multiValue = TRUE) {
public function fromEntityReference(string $field, ?ResolverInterface $entity = NULL, bool $multiValue = TRUE) {
return $this->builder->compose(
$this->builder->produce('entity_reference')
->map('field', $this->builder->fromValue($field))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\thunder_gqls\Functional;

use Drupal\redirect\Entity\Redirect;
use Drupal\Tests\graphql\Traits\DataProducerExecutionTrait;
use Drupal\redirect\Entity\Redirect;

/**
* Test the schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\Tests\thunder_gqls\Functional\DataProducer;

use Drupal\search_api\Query\QueryInterface;
use Drupal\Tests\graphql\Traits\DataProducerExecutionTrait;
use Drupal\Tests\thunder_gqls\Functional\ThunderGqlsTestBase;
use Drupal\search_api\Query\QueryInterface;

/**
* Test ThunderSearchApi data producer.
Expand Down
6 changes: 3 additions & 3 deletions modules/thunder_gqls/tests/src/Functional/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\thunder_gqls\Functional;

use Drupal\access_unpublished\Entity\AccessToken;
use Drupal\Component\Serialization\Json;
use Drupal\access_unpublished\Entity\AccessToken;
use Drupal\media\Entity\MediaType;
use Drupal\node\Entity\Node;

Expand Down Expand Up @@ -157,7 +157,7 @@ public function testNonExistingEntityLinks(): void {
}
GQL;

$variables = ['path' => 'user/1'];
$variables = ['path' => '/user/1'];
$response = $this->query($query, Json::encode($variables));
$page = $this->jsonDecode($response->getBody());
$this->assertArrayNotHasKey('errors', $page);
Expand Down Expand Up @@ -205,7 +205,7 @@ public function testLabelAccess(): void {
}
GQL;

$variables = ['path' => 'duis-autem-vel-eum-iriure'];
$variables = ['path' => '/duis-autem-vel-eum-iriure'];
$response = $this->query($query, Json::encode($variables));
$this->assertEquals(200, $response->getStatusCode(), 'Response not 200');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
* Test entities_with_term data producer.
Expand Down Expand Up @@ -121,6 +121,46 @@ public function setUp(): void {
$node3->save();

$this->parent = $parent;

$schema = <<<GQL
type Query {
articles: EntityList
}
type EntityList {
total: Int!
}
GQL;

$this->setUpSchema($schema);
}

/**
* Test cache metadata for the query.
*/
public function testQueryCacheMetadata(): void {
$query = <<<GQL
query {
articles {
total
}
}
GQL;

$this->mockResolver('Query', 'articles',
$this->builder->produce('entities_with_term')
->map('term', $this->builder->fromValue($this->parent))
->map('type', $this->builder->fromValue('node'))
->map('field', $this->builder->fromValue(self::TAXONOMY_FIELD_NAME))
);
$this->mockResolver('EntityList', 'total', $this->builder->fromValue(1));

$metadata = $this->defaultCacheMetaData();
$metadata->setCacheContexts(['user.permissions', 'user.node_grants:view']);
$metadata->addCacheTags(['node_list', 'taxonomy_term:' . $this->parent->id()]);

$this->assertResults($query, [], [
'articles' => ['total' => '1'],
], $metadata);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
* Data producers EntityLinks test class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\paragraphs\Entity\Paragraph;
use Drupal\paragraphs\Entity\ParagraphsType;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
* Tests the paragraphs behavior data producer.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
* Test entities_with_term data producer.
*
* @group Thunder
*/
class ThunderEntityListTest extends GraphQLTestBase {

/**
* {@inheritdoc}
*/
protected static $modules = [
'text',
'thunder_gqls',
];

/**
* {@inheritdoc}
*/
public function setUp(): void {
parent::setUp();

$schema = <<<GQL
type Query {
articles: EntityList
}
type EntityList {
total: Int!
}
GQL;

$this->setUpSchema($schema);
}

/**
* Test cache metadata for the query.
*/
public function testQueryCacheMetadata(): void {
$query = <<<GQL
query {
articles {
total
}
}
GQL;

$this->mockResolver('Query', 'articles',
$this->builder->produce('thunder_entity_list')
->map('type', $this->builder->fromValue('node'))
);
$this->mockResolver('EntityList', 'total', $this->builder->fromValue(1));

$metadata = $this->defaultCacheMetaData();
$metadata->setCacheContexts(['user.permissions', 'user.node_grants:view']);
$metadata->addCacheTags(['node_list']);

$this->assertResults($query, [], [
'articles' => ['total' => '1'],
], $metadata);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\node\Entity\Node;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\Tests\TestFileCreationTrait;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\node\Entity\Node;

/**
* Data producers Metatags test class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Drupal\Tests\thunder_gqls\Kernel\DataProducer;

use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\node\Entity\Node;
use Drupal\node\NodeInterface;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;

/**
* ThunderRedirect data producer test class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\Tests\thunder_gqls\Kernel\TypeResolver;

use Drupal\node\NodeInterface;
use Drupal\Tests\graphql\Kernel\GraphQLTestBase;
use Drupal\node\NodeInterface;
use Drupal\thunder_gqls\GraphQL\DecoratableTypeResolver;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Drupal\Core\File\FileExists;
use Drupal\Core\StreamWrapper\PublicStream;
use Drupal\file\Entity\File;
use Drupal\Tests\thunder\Functional\ThunderTestBase;
use Drupal\file\Entity\File;

/**
* Tests for transliteration of file names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\thunder_workflow\Plugin\Field\FieldWidget;

use Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget as CoreModerationStateWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget as CoreModerationStateWidget;

/**
* Plugin implementation of the 'thunder_moderation_state_default' widget.
Expand Down
4 changes: 2 additions & 2 deletions modules/thunder_workflow/src/ThunderWorkflowFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Drupal\thunder_workflow;

use Drupal\content_moderation\ModerationInformationInterface;
use Drupal\content_moderation\StateTransitionValidationInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
Expand All @@ -12,6 +10,8 @@
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Theme\ThemeManagerInterface;
use Drupal\Core\Url;
use Drupal\content_moderation\ModerationInformationInterface;
use Drupal\content_moderation\StateTransitionValidationInterface;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Loading

0 comments on commit dae2726

Please sign in to comment.