Skip to content

Commit 7eff2aa

Browse files
authored
tests(menu): Fix undefined variable in test (#1076)
1 parent b93c456 commit 7eff2aa

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

phpcs.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable">
2222
<exclude-pattern>src/Plugin/GraphQL/DataProducer/Field/EntityReference.php</exclude-pattern>
23-
<exclude-pattern>tests/src/Kernel/DataProducer/MenuTest.php</exclude-pattern>
2423
</rule>
2524

2625
<!-- TODO: those rules are disabled for now until we fix the coding standards for them. -->

tests/src/Kernel/DataProducer/MenuTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,20 @@ public function testMenuTreeSubtree() {
143143
*/
144144
public function testMenuLinkAttribute() {
145145
$attribute = 'target';
146+
$assert_happened = FALSE;
146147
foreach ($this->linkTree as $link_tree) {
148+
$options = $link_tree->link->getOptions();
147149
if (!empty($options['attributes'][$attribute])) {
148150
$result = $this->executeDataProducer('menu_link_attribute', [
149151
'link' => $link_tree->link,
150152
'attribute' => 'target',
151153
]);
152154

153155
$this->assertEquals($options['attributes'][$attribute], $result);
156+
$assert_happened = TRUE;
154157
}
155158
}
159+
$this->assertTrue($assert_happened, 'At least one menu attribute was tested');
156160
}
157161

158162
/**

0 commit comments

Comments
 (0)