diff --git a/composer.json b/composer.json index 64fa0f273e7935cca84f8234100fbcbfb4ea535f..2e4913d15ebdce042dd45e8917851a8cdb74bb36 100644 --- a/composer.json +++ b/composer.json @@ -14,16 +14,14 @@ ], "license": "MIT", "require": { - "php": ">=7.4.0", + "php": ">=8.1", "ext-json": "*", "marcj/topsort": "^2.0.0", "swaggest/json-schema": "^0.12", - "symfony/finder": "^3.4 || ^4 || ^6", - "symfony/polyfill-php80": "^1", - "symfony/polyfill-php81": "^1", - "symfony/serializer": "^3.4 || ^4 || ^6", - "symfony/property-access": "^3.4 || ^4 || ^6", - "symfony/yaml": "^3.4 || ^4 || ^6", + "symfony/finder": "^4 || ^5 || ^6", + "symfony/serializer": "^4 || ^5 || ^6", + "symfony/property-access": "^4 || ^5 || ^6", + "symfony/yaml": "^4 || ^5 || ^6", "webmozart/assert": "^1.0", "webmozart/path-util": "^2.1.0" }, diff --git a/modules/patternkit_example/patternkit_example.info.yml b/modules/patternkit_example/patternkit_example.info.yml index 17dcf0df522fc3edb4a8d93d479896637aaaa71f..971767df661dac41e34a926c7dc9c79b06b30c60 100644 --- a/modules/patternkit_example/patternkit_example.info.yml +++ b/modules/patternkit_example/patternkit_example.info.yml @@ -2,6 +2,6 @@ name: Patternkit Example description: Adds Patternkit example patterns. type: module package: Presentation Framework -core_version_requirement: ^9 || ^10 +core_version_requirement: ^10 dependencies: - patternkit diff --git a/modules/patternkit_media_library/patternkit_media_library.info.yml b/modules/patternkit_media_library/patternkit_media_library.info.yml index 885f0667a58bf977f4ca8e857861f8ebe3b36890..7baba11186b733ea88c7d33751a23bd23b97b34b 100644 --- a/modules/patternkit_media_library/patternkit_media_library.info.yml +++ b/modules/patternkit_media_library/patternkit_media_library.info.yml @@ -2,7 +2,7 @@ name: Patternkit Media Library Support description: Adds Media Library Support to upload fields. type: module package: Presentation Framework -core_version_requirement: ^9 || ^10 +core_version_requirement: ^10 configure: patternkit.settings dependencies: - drupal:media_library diff --git a/modules/patternkit_usage_tracking/patternkit_usage_tracking.info.yml b/modules/patternkit_usage_tracking/patternkit_usage_tracking.info.yml index ab854cbe8f99f250fb0c3aca92d77dbb822a929a..ca135463c02404077a422ed45b4a6ee769a1108d 100644 --- a/modules/patternkit_usage_tracking/patternkit_usage_tracking.info.yml +++ b/modules/patternkit_usage_tracking/patternkit_usage_tracking.info.yml @@ -2,8 +2,7 @@ name: Patternkit Usage Tracking description: Adds tracking for where patterns are in use. type: module package: Presentation Framework -core_version_requirement: ^9 || ^10 +core_version_requirement: ^10 dependencies: - patternkit:patternkit -php: 7.4 lifecycle: experimental diff --git a/modules/patternkit_usage_tracking/tests/src/Unit/UsageRevisionHelperTest.php b/modules/patternkit_usage_tracking/tests/src/Unit/UsageRevisionHelperTest.php index 1eed733f4a7e9d66fe775a3e3cf394ca881365f4..7f3215833e58815d55ea22e2adfcf174fe4d2bca 100644 --- a/modules/patternkit_usage_tracking/tests/src/Unit/UsageRevisionHelperTest.php +++ b/modules/patternkit_usage_tracking/tests/src/Unit/UsageRevisionHelperTest.php @@ -613,7 +613,7 @@ class UsageRevisionHelperTest extends UnitTestCase { 'component_uuid' => $uuids[1], 'pattern_id' => $patterns['nested'], 'is_nested' => TRUE, - 'content_path' => $nested_path = "$patterns[1]=>${patterns['nested']}", + 'content_path' => $nested_path = "$patterns[1]=>{$patterns['nested']}", 'layout_path' => "1.$uuids[1]:$nested_path", ], ], @@ -696,7 +696,7 @@ class UsageRevisionHelperTest extends UnitTestCase { 'register' => [ [ $patterns['nested'], - "1.$uuids[1]:" . ($nested_path = "$patterns[1]=>${patterns['nested']}"), + "1.$uuids[1]:" . ($nested_path = "$patterns[1]=>{$patterns['nested']}"), ], ], 'update' => [ @@ -769,7 +769,7 @@ class UsageRevisionHelperTest extends UnitTestCase { 'component_uuid' => $uuids[1], 'pattern_id' => $patterns['nested'], 'is_nested' => TRUE, - 'content_path' => $nested_path = "$patterns[1]=>${patterns['nested']}", + 'content_path' => $nested_path = "$patterns[1]=>{$patterns['nested']}", 'layout_path' => "1.$uuids[1]:$nested_path", ], ], @@ -848,7 +848,7 @@ class UsageRevisionHelperTest extends UnitTestCase { // Register the new nested pattern. [ $patterns['nested'], - "1.$uuids[1]:" . ($nested_path = "$patterns[1]=>${patterns['nested']}"), + "1.$uuids[1]:" . ($nested_path = "$patterns[1]=>{$patterns['nested']}"), ], ], 'update' => [ @@ -934,7 +934,7 @@ class UsageRevisionHelperTest extends UnitTestCase { // Register a new nested pattern within the updated component. [ $patterns['nested'], - "2.$uuids[1]:" . ($new_nested_path = "$patterns[1]=>${patterns['nested']}"), + "2.$uuids[1]:" . ($new_nested_path = "$patterns[1]=>{$patterns['nested']}"), ], ], 'update' => [ diff --git a/patternkit.info.yml b/patternkit.info.yml index a4c7e407f6f776dcda46a329cf6e6a8e9c56f9bc..3dd3d8b0ada0c29a4e4f0bfe350844dc3dc39c80 100644 --- a/patternkit.info.yml +++ b/patternkit.info.yml @@ -2,8 +2,8 @@ name: Patternkit description: Adds Patternkit patterns as blocks. type: module package: Presentation Framework -core_version_requirement: ^9 || ^10 +core_version_requirement: ^10 configure: patternkit.settings dependencies: - drupal:block_content -php: 7.4 +php: 8.1 diff --git a/src/Entity/Pattern.php b/src/Entity/Pattern.php index fb6fe06e02c1eb4b7de6e2e00041df011099c635..0e59d8f4e3a20fa3836775fa5bbba62b9a0decdf 100644 --- a/src/Entity/Pattern.php +++ b/src/Entity/Pattern.php @@ -73,6 +73,20 @@ class Pattern extends ContentEntityBase implements PatternInterface { */ protected bool $bundled = FALSE; + /** + * An array of the current Pattern instance's configuration values. + * + * @var array + */ + public array $config = []; + + /** + * An array of the current Pattern instance's contexts. + * + * @var array + */ + public array $context = []; + /** * Constructs a new Pattern object, without permanently saving it. * diff --git a/tests/src/Unit/JSONSchemaEditorTraitTest.php b/tests/src/Unit/JSONSchemaEditorTraitTest.php index f42ffec835db8153822054ddf50f2703ab738a09..52003e0ea2cd156e5c77bae01502896be1bef169 100644 --- a/tests/src/Unit/JSONSchemaEditorTraitTest.php +++ b/tests/src/Unit/JSONSchemaEditorTraitTest.php @@ -36,6 +36,13 @@ class JSONSchemaEditorTraitTest extends UnitTestCase { */ protected ObjectProphecy $fileUrlGenerator; + /** + * A mocked editor plugin manager service. + * + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\editor\Plugin\EditorManager> + */ + protected ObjectProphecy $editorPluginManager; + /** * A mocked query string service. * diff --git a/tests/src/Unit/PatternElementTest.php b/tests/src/Unit/PatternElementTest.php index 6e015a078ce0e6ffbc57500acbeae2bb7d48c658..5ef8171aab8d258567c3f0eafe8370447c0c6573 100644 --- a/tests/src/Unit/PatternElementTest.php +++ b/tests/src/Unit/PatternElementTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\patternkit\Unit; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\patternkit\Element\Pattern; +use Drupal\patternkit\Entity\Pattern as EntityPattern; use Drupal\patternkit\Entity\PatternInterface; use Drupal\patternkit\Exception\SchemaValidationException; use Drupal\patternkit\Exception\UnknownPatternException; @@ -173,7 +174,7 @@ class PatternElementTest extends RendererTestBase { ]; $this->libraryPlugin->expects($this->once()) ->method('render') - ->with($this->callback(function ($arg) use ($patternMock, $element) { + ->with($this->callback(function ($arg) use ($patternMock): bool { return $arg[0] == $patternMock; })) ->willReturn($returnValue); @@ -283,7 +284,10 @@ class PatternElementTest extends RendererTestBase { * A mocked pattern entity for testing. */ protected function getPatternMock(): PatternInterface { - $patternMock = $this->createMock(PatternInterface::class); + // Mock the implementation class instead of the interface to sidestep + // assignment to dynamic property deprecation warnings for instance + // variables declared on the class. + $patternMock = $this->createMock(EntityPattern::class); $patternMock->expects($this->once()) ->method('getCacheTags') ->willReturn([]); diff --git a/tests/src/Unit/Plugin/PatternFieldProcessor/TokenProcessorTest.php b/tests/src/Unit/Plugin/PatternFieldProcessor/TokenProcessorTest.php index a9c3b7ced01cbd69918f380524e034ae6b51dd2f..a96bde14bd18ee13836ac81f6a234aea452cd42f 100644 --- a/tests/src/Unit/Plugin/PatternFieldProcessor/TokenProcessorTest.php +++ b/tests/src/Unit/Plugin/PatternFieldProcessor/TokenProcessorTest.php @@ -176,7 +176,9 @@ JSON; $randomTitle = $this->getRandomGenerator()->name(); $expected = str_replace('[node:title]', $randomTitle, $value); $node = $this->createMock(NodeInterface::class); - $node->title = $randomTitle; + $node->method('get') + ->with('title') + ->willReturn($randomTitle); // Ensure the replacePlain method is not invoked for html formatted strings. $this->token->expects($this->never()) @@ -212,7 +214,9 @@ JSON; $randomTitle = $this->getRandomGenerator()->name(); $expected = str_replace('[node:title]', $randomTitle, $value); $node = $this->createMock(NodeInterface::class); - $node->title = $randomTitle; + $node->method('get') + ->with('title') + ->willReturn($randomTitle); // Ensure the replace method is not invoked for plain text strings. $this->token->expects($this->never()) diff --git a/tests/src/Unit/Schema/SchemaRefHandlerTest.php b/tests/src/Unit/Schema/SchemaRefHandlerTest.php index 776f590c671a98ae0d27425356a8f364f6b6d8b9..f7649980b6f94f110c3306211fdce03103b5b9f8 100644 --- a/tests/src/Unit/Schema/SchemaRefHandlerTest.php +++ b/tests/src/Unit/Schema/SchemaRefHandlerTest.php @@ -13,6 +13,13 @@ use Drupal\Tests\UnitTestCase; */ class SchemaRefHandlerTest extends UnitTestCase { + /** + * The schema ref handler instance being tested. + * + * @var \Drupal\patternkit\Schema\SchemaRefHandler + */ + protected SchemaRefHandler $schemaRefHandler; + /** * {@inheritdoc} */