From b13344d58df47d6d0a6df033dc5eaf55c48f7054 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 27 Apr 2020 11:36:17 +0545 Subject: [PATCH] Repace use of assertArraySubset in acceptance tests --- .../acceptance/features/bootstrap/Sharing.php | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 904736c4ccee..abf2c1b20c6b 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -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] + ); + } } /** @@ -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) {