Skip to content

Commit

Permalink
Repace use of assertArraySubset in acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Apr 27, 2020
1 parent 2a12126 commit b13344d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -2033,12 +2033,19 @@ function (&$value, $key) {
);
}

// check if attributes received from table is subset of actualAttributes
Assert::assertArraySubset(
$attributes,
$actualAttributesArray,
"The additional sharing attributes did not include the expected attributes. See the differences below."
);
// check if the expected attributes received from table match actualAttributes
foreach (['scope', 'key', 'enabled'] as $key) {
Assert::assertArrayHasKey(
$key,
$actualAttributesArray,
"the additional sharing attributes in the last response did not have key '$key'"
);
Assert::assertEquals(
$attributes[$key],
$actualAttributesArray[$key],
"the additional sharing attribute '$key' had value " . $actualAttributesArray[$key] . " but was expected to have value " . $actualAttributesArray[$key]
);
}
}

/**
Expand Down Expand Up @@ -2418,13 +2425,8 @@ public function assertSharesOfUserAreInState($user, $state, TableNode $table) {
$row['path'] = "/" . \trim($row['path'], "/");
foreach ($usersShares as $share) {
try {
Assert::assertArraySubset(
$row,
$share,
"Expected '"
. \ implode(', ', $row)
. "' was not included in the share of the user. See the difference below"
);
Assert::assertArrayHasKey('path', $share);
Assert::assertEquals($row['path'], $share['path']);
$found = true;
break;
} catch (PHPUnit\Framework\ExpectationFailedException $e) {
Expand Down

0 comments on commit b13344d

Please sign in to comment.