Skip to content

Commit 48a130c

Browse files
committed
Fix: Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent 2959487 commit 48a130c

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

tests/Core/Command/Apps/AppsDisableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testCommandInput($appId, $statusCode, $output): void {
6161

6262
$this->commandTester->execute($input);
6363

64-
$this->assertContains($output, $this->commandTester->getDisplay());
64+
$this->assertStringContainsString($output, $this->commandTester->getDisplay());
6565
$this->assertSame($statusCode, $this->commandTester->getStatusCode());
6666
}
6767

tests/Core/Command/Apps/AppsEnableTest.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ public function testCommandInput($appId, $groups, $statusCode, $output): void {
6666

6767
$this->commandTester->execute($input);
6868

69-
$this->assertContains($output, $this->commandTester->getDisplay());
69+
$this->assertStringContainsString($output, $this->commandTester->getDisplay());
7070
$this->assertSame($statusCode, $this->commandTester->getStatusCode());
7171
}
7272

7373
public function dataCommandInput(): array {
74-
return [
74+
$data = [
7575
[['admin_audit'], null, 0, 'admin_audit enabled'],
7676
[['comments'], null, 0, 'comments enabled'],
7777
[['invalid_app'], null, 1, 'Could not download app invalid_app'],
@@ -83,16 +83,20 @@ public function dataCommandInput(): array {
8383
[['comments'], ['admin'], 1, "comments can't be enabled for groups"],
8484

8585
[['updatenotification'], ['admin'], 0, 'updatenotification enabled for groups: admin'],
86-
# TODO: not reliable due to dependency to appstore
87-
# [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"],
8886
[['updatenotification', 'accessibility'], ['admin'], 0, "updatenotification enabled for groups: admin\naccessibility enabled for groups: admin"],
8987

9088
[['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification enabled for groups: admin'],
91-
# TODO: not reliable due to dependency to appstore
92-
# [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"],
93-
# [['updatenotification', 'contacts', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin\nCould not download app invalid_app"],
9489
[['updatenotification', 'accessibility'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\naccessibility enabled for groups: admin"],
9590
[['updatenotification', 'accessibility', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\naccessibility enabled for groups: admin\nCould not download app invalid_app"],
9691
];
92+
93+
if (getenv('CI') === false) {
94+
/** Tests disabled on drone/ci due to appstore dependency */
95+
$data[] = [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"];
96+
$data[] = [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin"];
97+
$data[] = [['updatenotification', 'contacts', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin\nCould not download app invalid_app"];
98+
}
99+
100+
return $data;
97101
}
98102
}

0 commit comments

Comments
 (0)