Otherwise build with PHP>8 will fail as PHPUnit 6 does not support it Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>tags/v25.0.0beta1
{ | { | ||||
"require-dev": { | "require-dev": { | ||||
"phpunit/phpunit": "~6.5", | |||||
"phpunit/phpunit": "^9", | |||||
"dms/phpunit-arraysubset-asserts": "^0.4", | |||||
"behat/behat": "~3.10.0", | "behat/behat": "~3.10.0", | ||||
"guzzlehttp/guzzle": "7.4.2", | "guzzlehttp/guzzle": "7.4.2", | ||||
"jarnaiz/behat-junit-formatter": "^1.3", | "jarnaiz/behat-junit-formatter": "^1.3", |
$this->sendingTo('get', '/cloud/apps?filter=enabled'); | $this->sendingTo('get', '/cloud/apps?filter=enabled'); | ||||
$this->theHTTPStatusCodeShouldBe('200'); | $this->theHTTPStatusCodeShouldBe('200'); | ||||
if ($enabled) { | if ($enabled) { | ||||
Assert::assertContains('testing', $this->response->getBody()->getContents()); | |||||
Assert::assertStringContainsString('testing', $this->response->getBody()->getContents()); | |||||
} else { | } else { | ||||
Assert::assertNotContains('testing', $this->response->getBody()->getContents()); | |||||
Assert::assertStringNotContainsString('testing', $this->response->getBody()->getContents()); | |||||
} | } | ||||
} | } | ||||
* @Then /^the command output contains the text "([^"]*)"$/ | * @Then /^the command output contains the text "([^"]*)"$/ | ||||
*/ | */ | ||||
public function theCommandOutputContainsTheText($text) { | public function theCommandOutputContainsTheText($text) { | ||||
Assert::assertContains($text, $this->lastStdOut, 'The command did not output the expected text on stdout'); | |||||
Assert::assertStringContainsString($text, $this->lastStdOut, 'The command did not output the expected text on stdout'); | |||||
} | } | ||||
/** | /** | ||||
* @Then /^the command error output contains the text "([^"]*)"$/ | * @Then /^the command error output contains the text "([^"]*)"$/ | ||||
*/ | */ | ||||
public function theCommandErrorOutputContainsTheText($text) { | public function theCommandErrorOutputContainsTheText($text) { | ||||
Assert::assertContains($text, $this->lastStdErr, 'The command did not output the expected text on stderr'); | |||||
Assert::assertStringContainsString($text, $this->lastStdErr, 'The command did not output the expected text on stderr'); | |||||
} | } | ||||
} | } |
* @Then /^transfer folder name contains "([^"]+)"$/ | * @Then /^transfer folder name contains "([^"]+)"$/ | ||||
*/ | */ | ||||
public function transferFolderNameContains($text) { | public function transferFolderNameContains($text) { | ||||
Assert::assertContains($text, $this->lastTransferPath); | |||||
Assert::assertStringContainsString($text, $this->lastTransferPath); | |||||
} | } | ||||
} | } |
Assert::assertTrue(in_array($expected, $value['element'], true)); | Assert::assertTrue(in_array($expected, $value['element'], true)); | ||||
} | } | ||||
} elseif (isset($value[0])) { | } elseif (isset($value[0])) { | ||||
Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($setting[1], $value[0]); | |||||
} else { | } else { | ||||
Assert::assertEquals('', $setting[1]); | Assert::assertEquals('', $setting[1]); | ||||
} | } | ||||
foreach ($settings->getRows() as $setting) { | foreach ($settings->getRows() as $setting) { | ||||
$value = json_decode(json_encode($groupDetails->{$setting[0]}), 1); | $value = json_decode(json_encode($groupDetails->{$setting[0]}), 1); | ||||
if (isset($value[0])) { | if (isset($value[0])) { | ||||
Assert::assertEquals($setting[1], $value[0], "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($setting[1], $value[0]); | |||||
} else { | } else { | ||||
Assert::assertEquals('', $setting[1]); | Assert::assertEquals('', $setting[1]); | ||||
} | } | ||||
$this->response = $client->get($fullUrl, $options); | $this->response = $client->get($fullUrl, $options); | ||||
$groups = [$group]; | $groups = [$group]; | ||||
$respondedArray = $this->getArrayOfGroupsResponded($this->response); | $respondedArray = $this->getArrayOfGroupsResponded($this->response); | ||||
Assert::assertNotEquals($groups, $respondedArray, "", 0.0, 10, true); | |||||
Assert::assertNotEqualsCanonicalizing($groups, $respondedArray); | |||||
Assert::assertEquals(200, $this->response->getStatusCode()); | Assert::assertEquals(200, $this->response->getStatusCode()); | ||||
} | } | ||||
$users = $usersList->getRows(); | $users = $usersList->getRows(); | ||||
$usersSimplified = $this->simplifyArray($users); | $usersSimplified = $this->simplifyArray($users); | ||||
$respondedArray = $this->getArrayOfUsersResponded($this->response); | $respondedArray = $this->getArrayOfUsersResponded($this->response); | ||||
Assert::assertEquals($usersSimplified, $respondedArray, "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($usersSimplified, $respondedArray); | |||||
} | } | ||||
} | } | ||||
$groups = $groupsList->getRows(); | $groups = $groupsList->getRows(); | ||||
$groupsSimplified = $this->simplifyArray($groups); | $groupsSimplified = $this->simplifyArray($groups); | ||||
$respondedArray = $this->getArrayOfGroupsResponded($this->response); | $respondedArray = $this->getArrayOfGroupsResponded($this->response); | ||||
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($groupsSimplified, $respondedArray); | |||||
} | } | ||||
} | } | ||||
$groups = $groupsList->getRows(); | $groups = $groupsList->getRows(); | ||||
$groupsSimplified = $this->simplifyArray($groups); | $groupsSimplified = $this->simplifyArray($groups); | ||||
$respondedArray = $this->getArrayOfSubadminsResponded($this->response); | $respondedArray = $this->getArrayOfSubadminsResponded($this->response); | ||||
Assert::assertEquals($groupsSimplified, $respondedArray, "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($groupsSimplified, $respondedArray); | |||||
} | } | ||||
} | } | ||||
$apps = $appList->getRows(); | $apps = $appList->getRows(); | ||||
$appsSimplified = $this->simplifyArray($apps); | $appsSimplified = $this->simplifyArray($apps); | ||||
$respondedArray = $this->getArrayOfAppsResponded($this->response); | $respondedArray = $this->getArrayOfAppsResponded($this->response); | ||||
Assert::assertEquals($appsSimplified, $respondedArray, "", 0.0, 10, true); | |||||
Assert::assertEqualsCanonicalizing($appsSimplified, $respondedArray); | |||||
} | } | ||||
} | } | ||||
Assert::assertFalse(in_array($expected, $value, true)); | Assert::assertFalse(in_array($expected, $value, true)); | ||||
} | } | ||||
} else { | } else { | ||||
Assert::assertNotEquals($setting[1], $value[0], "", 0.0, 10, true); | |||||
Assert::assertNotEqualsCanonicalizing($setting[1], $value[0]); | |||||
} | } | ||||
} else { | } else { | ||||
Assert::assertNotEquals('', $setting[1]); | Assert::assertNotEquals('', $setting[1]); |
* along with this program. If not, see <http://www.gnu.org/licenses/> | * along with this program. If not, see <http://www.gnu.org/licenses/> | ||||
* | * | ||||
*/ | */ | ||||
use DMS\PHPUnitExtensions\ArraySubset\Assert as AssertArraySubset; | |||||
use PHPUnit\Framework\Assert; | use PHPUnit\Framework\Assert; | ||||
require __DIR__ . '/../../vendor/autoload.php'; | require __DIR__ . '/../../vendor/autoload.php'; | ||||
return $item['{http://nextcloud.org/ns}trashbin-filename']; | return $item['{http://nextcloud.org/ns}trashbin-filename']; | ||||
}, $elementList)); | }, $elementList)); | ||||
Assert::assertArraySubset([$name], array_values($trashContent)); | |||||
AssertArraySubset::assertArraySubset([$name], array_values($trashContent)); | |||||
} | } | ||||
/** | /** |
"behat/mink": "1.8.1", | "behat/mink": "1.8.1", | ||||
"behat/mink-extension": "2.3.1", | "behat/mink-extension": "2.3.1", | ||||
"behat/mink-selenium2-driver": "1.4.0", | "behat/mink-selenium2-driver": "1.4.0", | ||||
"phpunit/phpunit": "6.5.14" | |||||
"phpunit/phpunit": "9.5.19" | |||||
}, | }, | ||||
"autoload": { | "autoload": { | ||||
"psr-4": { | "psr-4": { |
* @Then I see that the shared file preview shows the text :text | * @Then I see that the shared file preview shows the text :text | ||||
*/ | */ | ||||
public function iSeeThatTheSharedFilePreviewShowsTheText($text) { | public function iSeeThatTheSharedFilePreviewShowsTheText($text) { | ||||
Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText()); | |||||
Assert::assertStringContainsString($text, $this->actor->find(self::textPreview(), 10)->getText()); | |||||
} | } | ||||
/** | /** |