Skip to content

Commit fedf529

Browse files
committed
Added test case
1 parent 5e8b527 commit fedf529

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/src/Rules/EntityQueryHasAccessCheckRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,10 @@ public function cases(): \Generator
9696
[__DIR__.'/data/bug-475b.php'],
9797
[]
9898
];
99+
100+
yield 'bug-496.php' => [
101+
[__DIR__.'/data/bug-496.php'],
102+
[]
103+
];
99104
}
100105
}

tests/src/Rules/data/bug-496.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Bug496Example;
4+
5+
class TestClass {
6+
7+
/**
8+
* Tests non-chained entity queries with access check.
9+
*/
10+
public function bug496(string $entity_type): void
11+
{
12+
$query = \Drupal::entityQuery('node');
13+
$query->accessCheck(FALSE);
14+
$query->condition('field_test', 'foo', '=');
15+
$query->execute();
16+
17+
$query = \Drupal::entityQuery('node');
18+
$query->condition('field_test', 'foo', '=');
19+
$query->accessCheck(FALSE);
20+
$query->execute();
21+
}
22+
}

0 commit comments

Comments
 (0)