Skip to content

Commit 303854d

Browse files
committed
Replace deprecated PHPUnit code coverage annotations.
See sebastianbergmann/phpunit#3631.
1 parent 6271d51 commit 303854d

6 files changed

Lines changed: 28 additions & 81 deletions

File tree

‎modules/patternkit_usage_tracking/src/LayoutUsageTracker.php‎

Lines changed: 17 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
namespace Drupal\patternkit_usage_tracking;
44

55
use Drupal\Core\Config\ConfigFactoryInterface;
6-
use Drupal\Core\Config\ImmutableConfig;
76
use Drupal\Core\Entity\ContentEntityInterface;
87
use Drupal\Core\Entity\EntityFieldManagerInterface;
98
use Drupal\Core\Entity\EntityInterface;
109
use Drupal\Core\Entity\EntityTypeManagerInterface;
11-
use Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface;
1210
use Drupal\patternkit\LayoutHelper;
1311
use Drupal\patternkit\Utility\PatternDetector;
1412

@@ -20,80 +18,36 @@ class LayoutUsageTracker {
2018
use PatternLayoutDiscoveryTrait;
2119
use PatternLayoutUsageInsertTrait;
2220

23-
/**
24-
* Entity type manager service.
25-
*
26-
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
27-
*/
28-
protected EntityTypeManagerInterface $entityTypeManager;
29-
30-
/**
31-
* Entity field manager service.
32-
*
33-
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
34-
*/
35-
protected EntityFieldManagerInterface $entityFieldManager;
36-
37-
/**
38-
* The configuration factory service.
39-
*
40-
* @var \Drupal\Core\Config\ConfigFactoryInterface
41-
*/
42-
protected ConfigFactoryInterface $configFactory;
43-
44-
/**
45-
* The track config.
46-
*
47-
* @var \Drupal\Core\Config\ImmutableConfig
48-
*/
49-
protected ImmutableConfig $config;
50-
51-
/**
52-
* The pattern usage revision helper service.
53-
*
54-
* @var \Drupal\patternkit_usage_tracking\UsageRevisionHelper
55-
*/
56-
protected UsageRevisionHelper $revisionHelper;
57-
5821
/**
5922
* Create a new instance of a LayoutUsageDetector.
6023
*
61-
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
24+
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
6225
* The EntityTypeManager service.
63-
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
26+
* @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager
6427
* The EntityFieldManager service.
65-
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
28+
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
6629
* The factory for configuration objects.
67-
* @param \Drupal\patternkit_usage_tracking\PatternUsageManager $tracking_storage
30+
* @param \Drupal\patternkit_usage_tracking\PatternUsageManager $trackingStorage
6831
* The pattern usage tracking storage.
69-
* @param \Drupal\patternkit\LayoutHelper $layout_helper
32+
* @param \Drupal\patternkit\LayoutHelper $layoutHelper
7033
* The patternkit layout helper service.
71-
* @param \Drupal\patternkit\Utility\PatternDetector $pattern_detector
34+
* @param \Drupal\patternkit\Utility\PatternDetector $patternDetector
7235
* The pattern detector service.
73-
* @param \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface $section_storage_manager
36+
* @param \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface $sectionStorageManager
7437
* The section storage manager service.
75-
* @param \Drupal\patternkit_usage_tracking\UsageRevisionHelper $revision_helper
38+
* @param \Drupal\patternkit_usage_tracking\UsageRevisionHelper $revisionHelper
7639
* The pattern usage revision helper service.
7740
*/
7841
public function __construct(
79-
EntityTypeManagerInterface $entity_type_manager,
80-
EntityFieldManagerInterface $entity_field_manager,
81-
ConfigFactoryInterface $config_factory,
82-
PatternUsageManager $tracking_storage,
83-
LayoutHelper $layout_helper,
84-
PatternDetector $pattern_detector,
85-
SectionStorageManagerInterface $section_storage_manager,
86-
UsageRevisionHelper $revision_helper,
87-
) {
88-
$this->entityTypeManager = $entity_type_manager;
89-
$this->entityFieldManager = $entity_field_manager;
90-
$this->configFactory = $config_factory;
91-
$this->trackingStorage = $tracking_storage;
92-
$this->layoutHelper = $layout_helper;
93-
$this->patternDetector = $pattern_detector;
94-
$this->sectionStorageManager = $section_storage_manager;
95-
$this->revisionHelper = $revision_helper;
96-
}
42+
protected EntityTypeManagerInterface $entityTypeManager,
43+
protected EntityFieldManagerInterface $entityFieldManager,
44+
protected ConfigFactoryInterface $configFactory,
45+
protected PatternUsageManager $trackingStorage,
46+
protected LayoutHelper $layoutHelper,
47+
protected PatternDetector $patternDetector,
48+
protected $sectionStorageManager,
49+
protected UsageRevisionHelper $revisionHelper,
50+
) {}
9751

9852
/**
9953
* Test whether an entity should be tracked by this plugin.

‎modules/patternkit_usage_tracking/tests/src/Unit/LayoutUsageTrackerTest.php‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public function testShouldTrackEntity(): void {
187187
/**
188188
* @covers ::trackOnEntityUpdate
189189
* @covers ::__construct
190-
* @covers ::<protected>
191190
*/
192191
public function testTrackOnEntityUpdate(): void {
193192
$mock = $this->getPartialMock([
@@ -211,7 +210,6 @@ public function testTrackOnEntityUpdate(): void {
211210
/**
212211
* @covers ::trackOnEntityUpdate
213212
* @covers ::__construct
214-
* @covers ::<protected>
215213
*/
216214
public function testTrackOnEntityUpdateOnlyLatestRevision(): void {
217215
$mock = $this->getPartialMock([
@@ -242,7 +240,7 @@ public function testTrackOnEntityUpdateOnlyLatestRevision(): void {
242240
* @covers ::getPatternsByLayoutComponentByEntity
243241
* @covers ::shouldTrackEntity
244242
* @covers ::__construct
245-
* @covers ::<protected>
243+
* @covers \Drupal\patternkit_usage_tracking\PatternLayoutDiscoveryTrait::getNestedPatterns
246244
*/
247245
public function testTrackOnEntityCreation(): void {
248246
$layout = $this->prophesize(SectionListInterface::class)
@@ -311,13 +309,9 @@ public function testTrackOnEntityCreation(): void {
311309

312310
/**
313311
* @covers ::trackOnEntityCreation
314-
* @covers ::getNestedPatterns
315-
* @covers ::identifyPatternsByComponent
316-
* @covers ::getPatternsByLayoutComponent
317-
* @covers ::getPatternsByLayoutComponentByEntity
318312
* @covers ::shouldTrackEntity
319313
* @covers ::__construct
320-
* @covers ::<protected>
314+
* @covers \Drupal\patternkit_usage_tracking\PatternLayoutDiscoveryTrait
321315
*/
322316
public function testTrackOnEntityCreationWithNestedPatterns(): void {
323317
$layout = $this->prophesize(SectionListInterface::class)

‎modules/patternkit_usage_tracking/tests/src/Unit/UsageRevisionHelperTest.php‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,9 @@ public static function providerLoadPreviouslyTrackedPatterns(): array {
387387
}
388388

389389
/**
390-
* @covers ::trackOnEntityUpdate
391-
* @covers ::loadPreviouslyTrackedPatterns
392-
* @covers ::trackChanges
393-
* @covers ::shouldTrackEntity
394-
* @covers ::updateRelatedTranslations
395-
* @covers ::__construct
396-
* @covers ::<protected>
390+
* @covers \Drupal\patternkit_usage_tracking\UsageRevisionHelper
397391
* @covers \Drupal\patternkit_usage_tracking\PatternLayoutDiscoveryTrait
392+
* @covers \Drupal\patternkit_usage_tracking\PatternLayoutUsageInsertTrait
398393
*
399394
* @dataProvider providerTrackOnEntityUpdate
400395
*/

‎tests/src/Unit/Asset/PatternLibraryParser/TwigPatternLibraryParserTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function providerCreatePattern(): array {
125125

126126
/**
127127
* @covers ::parsePatternLibraryInfo
128-
* @covers ::<protected>
128+
* @covers \Drupal\patternkit\Asset\PatternLibraryParser\TwigPatternLibraryParser
129129
* @uses \Drupal\patternkit\Asset\PatternLibraryParser\TwigPatternLibraryParser::createPattern()
130130
* @uses \Drupal\patternkit\Asset\PatternLibraryParserBase
131131
*/

‎tests/src/Unit/PatternLibraryPluginManagerTest.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ protected function getPluginManager(iterable $namespaces = []): PatternLibraryPl
9999
* The plugin ID to generate a fallback for.
100100
*
101101
* @covers ::getFallbackPluginId
102+
* @covers \Drupal\patternkit\PatternLibraryPluginManager
102103
*
103104
* @dataProvider providerGetFallbackPluginId()
104105
*/
@@ -121,6 +122,7 @@ public static function providerGetFallbackPluginId(): array {
121122
* Test getFallbackPluginId() behavior with no successful result available.
122123
*
123124
* @covers ::getFallbackPluginId()
125+
* @covers \Drupal\patternkit\PatternLibraryPluginManager
124126
*/
125127
public function testGetFallbackPluginIdFailure(): void {
126128
$pluginManager = $this->getPluginManager();
@@ -135,6 +137,7 @@ public function testGetFallbackPluginIdFailure(): void {
135137
* Test valid calls to createInstance().
136138
*
137139
* @covers ::createInstance
140+
* @covers \Drupal\patternkit\PatternLibraryPluginManager
138141
*/
139142
public function testCreateInstance(): void {
140143
$pluginManager = $this->getPluginManager();
@@ -160,6 +163,7 @@ public function testCreateInstance(): void {
160163
* @covers ::createInstance
161164
* @covers ::handlePluginNotFound
162165
* @covers ::getFallbackPluginId
166+
* @covers \Drupal\patternkit\PatternLibraryPluginManager
163167
*/
164168
public function testCreateInstanceWithFallback(): void {
165169
$pluginManager = $this->getPluginManager();
@@ -213,6 +217,7 @@ public function testCreateInstanceWithFallback(): void {
213217
* @covers ::createInstance
214218
* @covers ::handlePluginNotFound
215219
* @covers ::getFallbackPluginId
220+
* @covers \Drupal\patternkit\PatternLibraryPluginManager
216221
*/
217222
public function testCreateInstanceWithFallbackFailure(): void {
218223
$pluginManager = $this->getPluginManager();

‎tests/src/Unit/Schema/SchemaIteratorTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,7 @@ public function testGetChildren() {
326326

327327
/**
328328
* @covers ::getPropertySchema
329-
* @covers ::<public>
330-
* @uses \Drupal\patternkit\Schema\SchemaIterator::__construct
329+
* @covers \Drupal\patternkit\Schema\SchemaIterator
331330
*/
332331
public function testGetPropertySchema() {
333332
$schema_json = $this->loadFixture('schemas/composed_component.json');

0 commit comments

Comments
 (0)