From 28f2d0ec7a51fdeab1d7294346ad8c3bc92cb6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 29 Dec 2020 19:48:38 +0100 Subject: [PATCH] Make integration tests work with both PHP 7.3 and 7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Trashbin" and "WebDav" traits were using each other in a circular dependency ("WebDav" -> "Sharing" -> "Provisioning" -> "BasicStructure" -> "Trashbin" -> "WebDav"). In PHP 7.3 this worked fine, but in PHP 7.4 the fatal error "Trait 'WebDav' not found in .../Trashbin.php" was thrown. To solve this now the "TrashBin" trait no longer explicitly uses "WebDav". However, due to this change, the class using "TrashBin" is now expected to also use "WebDav". As the "Trashbin" trait was not needed by most contexts using the "BasicStructure" trait "Trashbin" was removed from it and added only to those contexts that actually need it. Signed-off-by: Daniel Calviño Sánchez --- build/integration/features/bootstrap/BasicStructure.php | 1 - build/integration/features/bootstrap/FeatureContext.php | 1 + build/integration/features/bootstrap/SharingContext.php | 3 ++- build/integration/features/bootstrap/Trashbin.php | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index c8c40d2a98bb5..fcccddc318f54 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -47,7 +47,6 @@ trait BasicStructure { use Avatar; use Download; use Mail; - use Trashbin; /** @var string */ private $currentUser = ''; diff --git a/build/integration/features/bootstrap/FeatureContext.php b/build/integration/features/bootstrap/FeatureContext.php index 66e2282608e00..e9c486daa4dcf 100644 --- a/build/integration/features/bootstrap/FeatureContext.php +++ b/build/integration/features/bootstrap/FeatureContext.php @@ -35,4 +35,5 @@ class FeatureContext implements Context, SnippetAcceptingContext { use Search; use WebDav; + use Trashbin; } diff --git a/build/integration/features/bootstrap/SharingContext.php b/build/integration/features/bootstrap/SharingContext.php index b1a4c1aa48b9c..be719cbf3794a 100644 --- a/build/integration/features/bootstrap/SharingContext.php +++ b/build/integration/features/bootstrap/SharingContext.php @@ -32,7 +32,8 @@ * Features context. */ class SharingContext implements Context, SnippetAcceptingContext { - use Sharing; + use WebDav; + use Trashbin; use AppConfiguration; use CommandLine; diff --git a/build/integration/features/bootstrap/Trashbin.php b/build/integration/features/bootstrap/Trashbin.php index 3eb6ce812ec3f..536ed6a90154e 100644 --- a/build/integration/features/bootstrap/Trashbin.php +++ b/build/integration/features/bootstrap/Trashbin.php @@ -30,7 +30,8 @@ * Trashbin functions */ trait Trashbin { - use WebDav; + + // WebDav trait is expected to be used in the class that uses this trait. /** * @When User :user empties trashbin