|
12 | 12 | use Drupal\Core\Extension\ModuleHandlerInterface; |
13 | 13 | use Drupal\Core\Logger\LoggerChannelInterface; |
14 | 14 | use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface; |
| 15 | +use Drupal\Core\Theme\ComponentPluginManager; |
15 | 16 | use Drupal\Core\Theme\ThemeManagerInterface; |
16 | 17 | use Drupal\patternkit\Asset\PatternDependencyResolver; |
17 | 18 | use Drupal\patternkit\Asset\PatternLibraryParserInterface; |
@@ -44,87 +45,94 @@ abstract class PatternLibraryParserTestBase extends UnitTestCase { |
44 | 45 | /** |
45 | 46 | * The module handler service. |
46 | 47 | * |
47 | | - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\Prophecy\Prophecy\ObjectProphecy |
| 48 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Extension\ModuleHandlerInterface> |
48 | 49 | */ |
49 | 50 | protected ObjectProphecy $moduleHandler; |
50 | 51 |
|
51 | 52 | /** |
52 | 53 | * The theme manager service. |
53 | 54 | * |
54 | | - * @var \Drupal\Core\Theme\ThemeManagerInterface|\Prophecy\Prophecy\ObjectProphecy |
| 55 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Theme\ThemeManagerInterface> |
55 | 56 | */ |
56 | 57 | protected ObjectProphecy $themeManager; |
57 | 58 |
|
58 | 59 | /** |
59 | 60 | * A serializer service. |
60 | 61 | * |
61 | | - * @var \Drupal\Component\Serialization\SerializationInterface|\Prophecy\Prophecy\ObjectProphecy |
| 62 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Component\Serialization\SerializationInterface> |
62 | 63 | */ |
63 | 64 | protected ObjectProphecy $serializer; |
64 | 65 |
|
65 | 66 | /** |
66 | 67 | * The stream wrapper manager service. |
67 | 68 | * |
68 | | - * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface|\Prophecy\Prophecy\ObjectProphecy |
| 69 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\StreamWrapper\StreamWrapperManagerInterface> |
69 | 70 | */ |
70 | 71 | protected ObjectProphecy $streamWrapperManager; |
71 | 72 |
|
72 | 73 | /** |
73 | 74 | * The library directory file finder service. |
74 | 75 | * |
75 | | - * @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder|\Prophecy\Prophecy\ObjectProphecy |
| 76 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Asset\LibrariesDirectoryFileFinder> |
76 | 77 | */ |
77 | 78 | protected ObjectProphecy $librariesDirectoryFileFinder; |
78 | 79 |
|
79 | 80 | /** |
80 | 81 | * The extension path resolver service. |
81 | 82 | * |
82 | | - * @var \Drupal\Core\Extension\ExtensionPathResolver|\Prophecy\Prophecy\ObjectProphecy |
| 83 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Extension\ExtensionPathResolver> |
83 | 84 | */ |
84 | 85 | protected ObjectProphecy $extensionPathResolver; |
85 | 86 |
|
86 | 87 | /** |
87 | 88 | * The entity type manager service. |
88 | 89 | * |
89 | | - * @var \Drupal\Core\Entity\EntityTypeManagerInterface|\Prophecy\Prophecy\ObjectProphecy |
| 90 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Entity\EntityTypeManagerInterface> |
90 | 91 | */ |
91 | 92 | protected ObjectProphecy $entityTypeManager; |
92 | 93 |
|
93 | 94 | /** |
94 | 95 | * The pattern storage handler. |
95 | 96 | * |
96 | | - * @var \Drupal\Core\Entity\EntityStorageInterface|\Prophecy\Prophecy\ObjectProphecy |
| 97 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Entity\EntityStorageInterface> |
97 | 98 | */ |
98 | 99 | protected ObjectProphecy $patternStorage; |
99 | 100 |
|
100 | 101 | /** |
101 | 102 | * The schema data preprocessor factory service. |
102 | 103 | * |
103 | | - * @var \Drupal\patternkit\Schema\DataPreProcessorFactory|\Prophecy\Prophecy\ObjectProphecy |
| 104 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\patternkit\Schema\DataPreProcessorFactory> |
104 | 105 | */ |
105 | 106 | protected ObjectProphecy $dataPreProcessorFactory; |
106 | 107 |
|
107 | 108 | /** |
108 | 109 | * The pattern dependency resolver service. |
109 | 110 | * |
110 | | - * @var \Drupal\patternkit\Asset\PatternDependencyResolver|ObjectProphecy |
| 111 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\patternkit\Asset\PatternDependencyResolver> |
111 | 112 | */ |
112 | 113 | protected ObjectProphecy $patternDependencyResolver; |
113 | 114 |
|
114 | 115 | /** |
115 | 116 | * The patternkit logger channel. |
116 | 117 | * |
117 | | - * @var \Drupal\Core\Logger\LoggerChannelInterface|\Prophecy\Prophecy\ObjectProphecy |
| 118 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Logger\LoggerChannelInterface> |
118 | 119 | */ |
119 | 120 | protected ObjectProphecy $logger; |
120 | 121 |
|
121 | 122 | /** |
122 | 123 | * The pattern environment service. |
123 | 124 | * |
124 | | - * @var \Drupal\patternkit\PatternkitEnvironment|\Prophecy\Prophecy\ObjectProphecy |
| 125 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\patternkit\PatternkitEnvironment> |
125 | 126 | */ |
126 | 127 | protected ObjectProphecy $environment; |
127 | 128 |
|
| 129 | + /** |
| 130 | + * The component plugin manager service if it exists. |
| 131 | + * |
| 132 | + * @var \Prophecy\Prophecy\ObjectProphecy<\Drupal\Core\Theme\ComponentPluginManager>|null |
| 133 | + */ |
| 134 | + protected ?ObjectProphecy $componentPluginManager; |
| 135 | + |
128 | 136 | /** |
129 | 137 | * The pattern library parser being tested. |
130 | 138 | * |
@@ -178,6 +186,8 @@ protected function setUpParserDependencies(): void { |
178 | 186 | $this->logger = $this->prophesize(LoggerChannelInterface::class); |
179 | 187 | $this->environment = $this->prophesize(PatternkitEnvironment::class); |
180 | 188 | $this->environment->isDebug()->willReturn(FALSE); |
| 189 | + $this->componentPluginManager = class_exists(ComponentPluginManager::class) ? |
| 190 | + $this->prophesize(ComponentPluginManager::class) : NULL; |
181 | 191 |
|
182 | 192 | $this->entityTypeManager->getStorage('patternkit_pattern') |
183 | 193 | ->willReturn($this->patternStorage->reveal()); |
@@ -205,6 +215,7 @@ protected function getParserInstance(): PatternLibraryParserInterface { |
205 | 215 | $this->dataPreProcessorFactory->reveal(), |
206 | 216 | $this->patternDependencyResolver->reveal(), |
207 | 217 | $this->logger->reveal(), |
| 218 | + is_null($this->componentPluginManager) ? NULL : $this->componentPluginManager->reveal(), |
208 | 219 | ); |
209 | 220 |
|
210 | 221 | if ($parser instanceof PatternkitEnvironmentAwareInterface) { |
@@ -235,6 +246,7 @@ protected function getPartialMock(): MockBuilder { |
235 | 246 | $this->dataPreProcessorFactory->reveal(), |
236 | 247 | $this->patternDependencyResolver->reveal(), |
237 | 248 | $this->logger->reveal(), |
| 249 | + is_null($this->componentPluginManager) ? NULL : $this->componentPluginManager->reveal(), |
238 | 250 | ]); |
239 | 251 | } |
240 | 252 |
|
|
0 commit comments