From 6ece18bc52320ab178206658fb169ba35c28e6cd Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Tue, 19 Jul 2022 12:57:32 +0545 Subject: [PATCH] Adjust test for limit search assertion --- .../acceptance/features/bootstrap/WebDav.php | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 9d16f7d3425b..3f1d1e8202c7 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -5054,7 +5054,7 @@ function ($value) { }, $elementRows ); - $resultEntries = $this->findEntryFromPropfindResponse(null, $user); + $resultEntries = $this->findEntryFromPropfindResponse(null, $user, "REPORT"); foreach ($resultEntries as $resultEntry) { Assert::assertContains($resultEntry, $expectedEntries); } @@ -5297,18 +5297,25 @@ public function findEntryFromPropfindResponse( foreach ($multistatusResults as $multistatusResult) { $entryPath = $multistatusResult['value'][0]['value']; if (OcisHelper::isTestingOnOcis() && $method === "REPORT") { - $entryName = \rawurldecode($entryPath); - if (str_ends_with($entryName, $entryNameToSearch)) { - return $multistatusResult; - } - } else { - $entryName = \str_replace($topWebDavPath, "", $entryPath); - $entryName = \rawurldecode($entryName); - $entryName = \trim($entryName, "/"); - if ($trimmedEntryNameToSearch === $entryName) { - return $multistatusResult; + if ($entryNameToSearch !== null && str_ends_with($entryPath, $entryNameToSearch)) { + return $multistatusResults; + } else { + $spaceId = WebDavHelper::getPersonalSpaceIdForUser( + $this->getBaseUrl(), + $user, + $this->getPasswordForUser($user), + $this->getStepLineRef() + ); + $splitSpaceID = explode("$", $spaceId); + $topWebDavPath = "/dav/spaces/" . $splitSpaceID[0] . "%21" . "$splitSpaceID[1]" . "/"; } } + $entryName = \str_replace($topWebDavPath, "", $entryPath); + $entryName = \rawurldecode($entryName); + $entryName = \trim($entryName, "/"); + if ($trimmedEntryNameToSearch === $entryName) { + return $multistatusResult; + } \array_push($results, $entryName); } }