Skip to content

Commit da2ba28

Browse files
richardbporterRichard B. Porter
andauthored
Loosen Drupal version constraints to allow 10, disable account notifications in toggle test. (#98)
* Disable account notifications in toggle test * Pull db-url from env var * Ignore composer.lock * Ignore phpunit.xml * Allow Drupal 10 * Set DB URL user PW in default env var * Explicitly set accessCheck in entityQueries --------- Co-authored-by: Richard B. Porter <rbp@richardbporter.com>
1 parent 374f445 commit da2ba28

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
composer.lock
12
vendor
23
.idea
34
.vscode
45
.scenarios.lock
56
sut
67
.phpunit.result.cache
7-
.DS_Store
8+
.DS_Store
9+
phpunit.xml

UsersCommands.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function listAll(array $options = [
8080
]) {
8181
// Use an entityQuery to dynamically set property conditions.
8282
$query = \Drupal::entityQuery('user')
83+
->accessCheck(FALSE)
8384
->condition('uid', 0, '!=');
8485

8586
if (isset($options['status'])) {
@@ -196,6 +197,7 @@ public function validateList(CommandData $commandData) {
196197
public function toggle() {
197198
// Get all users.
198199
$ids = \Drupal::entityQuery('user')
200+
->accessCheck(FALSE)
199201
->condition('uid', 0, '!=')
200202
->execute();
201203

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"require-dev": {
1919
"phpunit/phpunit": "^9.5",
2020
"squizlabs/php_codesniffer": "^3",
21-
"drupal/core-recommended": "^9.3",
22-
"drupal/core-composer-scaffold": "^10.0",
21+
"drupal/core-recommended": "^9.3 || ^10.0",
22+
"drupal/core-composer-scaffold": "^9.3 || ^10.0",
2323
"mglaman/drupal-check": "^1.4",
2424
"symfony/phpunit-bridge": "^6.1",
2525
"drupal/coder": "^8.3"

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
<php>
1313
<!--DB User must have create/drop permissions-->
14-
<var name="TEST_DB_URL" value="mysql://root@localhost/drupal"/>
14+
<env name="DRUPAL_TEST_DB_URL" value="mysql://root:root@localhost/drupal"/>
1515
</php>
1616
</phpunit>

tests/ListTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function setUp() :void {
1919

2020
$this->drush('site:install', ['testing'], [
2121
'root' => 'sut',
22+
'db-url' => getenv('DRUPAL_TEST_DB_URL'),
2223
]);
2324

2425
$this->drush('role:create', ['editor']);

tests/ToggleTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ public function setUp() :void {
1919

2020
$this->drush('site:install', ['testing'], [
2121
'root' => 'sut',
22+
'db-url' => getenv('DRUPAL_TEST_DB_URL'),
2223
]);
2324

25+
$this->drush('config:set', ['user.settings', 'notify.status_activated', 0]);
26+
$this->drush('config:set', ['user.settings', 'notify.status_blocked', 0]);
2427
$this->drush('user:create', ['foo']);
2528
$this->drush('user:create', ['bar']);
2629
$this->drush('user:block', ['bar']);

0 commit comments

Comments
 (0)