Skip to content

Commit a3ab953

Browse files
authored
Merge pull request #36513 from owncloud/tests-do-not-depend-on-core-dependencies
Remove dependency of acceptance tests on core lib/composer/autoload.php
2 parents 7b6cd5c + 2337236 commit a3ab953

File tree

12 files changed

+12
-26
lines changed

12 files changed

+12
-26
lines changed

tests/TestHelpers/SharingHelper.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class SharingHelper {
4545
'federated' => 6,
4646
];
4747

48+
const SHARE_STATES = [
49+
'accepted' => 0,
50+
'pending' => 1,
51+
'rejected' => 2,
52+
'declined' => 2, // declined is a synonym for rejected
53+
];
54+
4855
/**
4956
*
5057
* @param string $baseUrl baseURL of the ownCloud installation without /ocs.

tests/acceptance/features/bootstrap/AppConfiguration.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
use TestHelpers\SetupHelper;
3030
use Behat\Gherkin\Node\TableNode;
3131

32-
require __DIR__ . '/../../../../lib/composer/autoload.php';
33-
3432
/**
3533
* AppConfiguration trait
3634
*/

tests/acceptance/features/bootstrap/AppManagementContext.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
use PHPUnit\Framework\Assert;
2626
use TestHelpers\SetupHelper;
2727

28-
require __DIR__ . '/../../../../lib/composer/autoload.php';
29-
3028
/**
3129
* Context for steps that test apps_paths.
3230
*/

tests/acceptance/features/bootstrap/Auth.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
use TestHelpers\HttpRequestHelper;
2424
use Behat\Gherkin\Node\TableNode;
2525

26-
require __DIR__ . '/../../../../lib/composer/autoload.php';
27-
2826
/**
2927
* Authentication functions
3028
*/

tests/acceptance/features/bootstrap/BasicStructure.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
use TestHelpers\SetupHelper;
3131
use TestHelpers\HttpRequestHelper;
3232

33-
require __DIR__ . '/../../../../lib/composer/autoload.php';
34-
3533
/**
3634
* Basic functions needed by mostly everything
3735
*/

tests/acceptance/features/bootstrap/CalDavContext.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*
2020
*/
2121

22-
require __DIR__ . '/../../../../lib/composer/autoload.php';
23-
2422
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
2523
use GuzzleHttp\Message\ResponseInterface;
2624
use TestHelpers\HttpRequestHelper;

tests/acceptance/features/bootstrap/CardDavContext.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*
2020
*/
2121

22-
require __DIR__ . '/../../../../lib/composer/autoload.php';
23-
2422
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
2523
use GuzzleHttp\Message\ResponseInterface;
2624
use TestHelpers\HttpRequestHelper;

tests/acceptance/features/bootstrap/CommandLine.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
use TestHelpers\SetupHelper;
2323

24-
require __DIR__ . '/../../../../lib/composer/autoload.php';
25-
2624
/**
2725
* Command line functions
2826
*/

tests/acceptance/features/bootstrap/Provisioning.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
use TestHelpers\UserHelper;
2929
use TestHelpers\HttpRequestHelper;
3030

31-
require __DIR__ . '/../../../../lib/composer/autoload.php';
32-
3331
/**
3432
* Functions for provisioning of users and groups
3533
*/

tests/acceptance/features/bootstrap/Sharing.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
use TestHelpers\SharingHelper;
3030
use TestHelpers\HttpRequestHelper;
3131

32-
require __DIR__ . '/../../../../lib/composer/autoload.php';
33-
3432
/**
3533
* Sharing trait
3634
*/
@@ -1914,14 +1912,10 @@ public function administratorAddsGroupToExcludeFromSharingList($group) {
19141912
private function getAllSharesSharedWithUser($user, $state = "all") {
19151913
switch ($state) {
19161914
case 'pending':
1917-
$stateCode = \OCP\Share::STATE_PENDING;
1918-
break;
19191915
case 'accepted':
1920-
$stateCode = \OCP\Share::STATE_ACCEPTED;
1921-
break;
19221916
case 'declined':
19231917
case 'rejected':
1924-
$stateCode = \OCP\Share::STATE_REJECTED;
1918+
$stateCode = SharingHelper::SHARE_STATES[$state];
19251919
break;
19261920
case 'all':
19271921
$stateCode = "all";

0 commit comments

Comments
 (0)