Skip to content

Commit ba9e1c0

Browse files
authored
Merge pull request #26276 from nextcloud/backport/26265/stable21
[stable21] Fix casing of core test folder, bring back missing tests
2 parents 88b0b5a + bb7ff7f commit ba9e1c0

File tree

10 files changed

+42
-33
lines changed

10 files changed

+42
-33
lines changed

tests/Core/Command/Apps/AppsDisableTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ public function testCommandInput($appId, $statusCode, $output): void {
6868

6969
public function dataCommandInput(): array {
7070
return [
71-
[['admin_audit'], 0, 'admin_audit 1.10.0 disabled'],
72-
[['comments'], 0, 'comments 1.10.0 disabled'],
71+
[['admin_audit'], 0, 'admin_audit 1.11.0 disabled'],
72+
[['comments'], 0, 'comments 1.11.0 disabled'],
7373
[['invalid_app'], 0, 'No such app enabled: invalid_app'],
7474

75-
[['admin_audit', 'comments'], 0, "admin_audit 1.10.0 disabled\ncomments 1.10.0 disabled"],
76-
[['admin_audit', 'comments', 'invalid_app'], 0, "admin_audit 1.10.0 disabled\ncomments 1.10.0 disabled\nNo such app enabled: invalid_app"],
75+
[['admin_audit', 'comments'], 0, "admin_audit 1.11.0 disabled\ncomments 1.11.0 disabled"],
76+
[['admin_audit', 'comments', 'invalid_app'], 0, "admin_audit 1.11.0 disabled\ncomments 1.11.0 disabled\nNo such app enabled: invalid_app"],
7777

7878
[['files'], 2, "files can't be disabled"],
7979
[['provisioning_api'], 2, "provisioning_api can't be disabled"],
8080

81-
[['files', 'admin_audit'], 2, "files can't be disabled.\nadmin_audit 1.10.0 disabled"],
82-
[['provisioning_api', 'comments'], 2, "provisioning_api can't be disabled.\ncomments 1.10.0 disabled"],
81+
[['files', 'admin_audit'], 2, "files can't be disabled.\nadmin_audit 1.11.0 disabled"],
82+
[['provisioning_api', 'comments'], 2, "provisioning_api can't be disabled.\ncomments 1.11.0 disabled"],
8383

8484
];
8585
}

tests/Core/Command/Apps/AppsEnableTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,28 @@ public function testCommandInput($appId, $groups, $statusCode, $output): void {
7373

7474
public function dataCommandInput(): array {
7575
$data = [
76-
[['admin_audit'], null, 0, 'admin_audit 1.10.0 enabled'],
77-
[['comments'], null, 0, 'comments 1.10.0 enabled'],
78-
[['comments', 'comments'], null, 0, "comments 1.10.0 enabled\ncomments already enabled"],
76+
[['admin_audit'], null, 0, 'admin_audit 1.11.0 enabled'],
77+
[['comments'], null, 0, 'comments 1.11.0 enabled'],
78+
[['comments', 'comments'], null, 0, "comments 1.11.0 enabled\ncomments already enabled"],
7979
[['invalid_app'], null, 1, 'Could not download app invalid_app'],
8080

81-
[['admin_audit', 'comments'], null, 0, "admin_audit 1.10.0 enabled\ncomments 1.10.0 enabled"],
82-
[['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit 1.10.0 enabled\ncomments 1.10.0 enabled\nCould not download app invalid_app"],
81+
[['admin_audit', 'comments'], null, 0, "admin_audit 1.11.0 enabled\ncomments 1.11.0 enabled"],
82+
[['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit 1.11.0 enabled\ncomments 1.11.0 enabled\nCould not download app invalid_app"],
8383

8484
[['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"],
8585
[['comments'], ['admin'], 1, "comments can't be enabled for groups"],
8686

87-
[['updatenotification'], ['admin'], 0, 'updatenotification 1.10.0 enabled for groups: admin'],
88-
[['updatenotification', 'accessibility'], ['admin'], 0, "updatenotification 1.10.0 enabled for groups: admin\naccessibility 1.6.0 enabled for groups: admin"],
87+
[['updatenotification'], ['admin'], 0, 'updatenotification 1.11.0 enabled for groups: admin'],
88+
[['updatenotification', 'accessibility'], ['admin'], 0, "updatenotification 1.11.0 enabled for groups: admin\naccessibility 1.7.0 enabled for groups: admin"],
8989

90-
[['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification 1.10.0 enabled for groups: admin'],
91-
[['updatenotification', 'accessibility'], ['admin', 'invalid_group'], 0, "updatenotification 1.10.0 enabled for groups: admin\naccessibility 1.6.0 enabled for groups: admin"],
92-
[['updatenotification', 'accessibility', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification 1.10.0 enabled for groups: admin\naccessibility 1.6.0 enabled for groups: admin\nCould not download app invalid_app"],
90+
[['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification 1.11.0 enabled for groups: admin'],
91+
[['updatenotification', 'accessibility'], ['admin', 'invalid_group'], 0, "updatenotification 1.11.0 enabled for groups: admin\naccessibility 1.7.0 enabled for groups: admin"],
92+
[['updatenotification', 'accessibility', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification 1.11.0 enabled for groups: admin\naccessibility 1.7.0 enabled for groups: admin\nCould not download app invalid_app"],
9393
];
9494

9595
if (getenv('CI') === false) {
9696
/** Tests disabled on drone/ci due to appstore dependency */
97-
$data[] = [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification 1.10.0 enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"];
97+
$data[] = [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification 1.11.0 enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"];
9898
$data[] = [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"];
9999
$data[] = [['updatenotification', 'contacts', 'invalid_app'], ['admin', 'invalid_group'], 1, "updatenotification enabled for groups: admin\ncontacts enabled for groups: admin\nCould not download app invalid_app"];
100100
}

tests/Core/Command/Preview/RepairTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use OCP\Files\Node;
1010
use OCP\IConfig;
1111
use OCP\ILogger;
12+
use OCP\Lock\ILockingProvider;
1213
use PHPUnit\Framework\MockObject\MockObject;
1314
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
1415
use Symfony\Component\Console\Input\InputInterface;
@@ -43,7 +44,13 @@ protected function setUp(): void {
4344
->getMock();
4445
$this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)
4546
->getMock();
46-
$this->repair = new Repair($this->config, $this->rootFolder, $this->logger, $this->iniGetWrapper);
47+
$this->repair = new Repair(
48+
$this->config,
49+
$this->rootFolder,
50+
$this->logger,
51+
$this->iniGetWrapper,
52+
$this->createMock(ILockingProvider::class)
53+
);
4754
$this->input = $this->getMockBuilder(InputInterface::class)
4855
->getMock();
4956
$this->input->expects($this->any())

tests/Core/Controller/AutoCompleteControllerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public function searchDataProvider() {
7575
],
7676
// expected
7777
[
78-
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'],
79-
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'],
78+
[ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
79+
[ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
8080
],
8181
'',
8282
'files',
@@ -96,8 +96,8 @@ public function searchDataProvider() {
9696
],
9797
// expected
9898
[
99-
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'],
100-
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'],
99+
[ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
100+
[ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
101101
],
102102
'',
103103
null,
@@ -117,8 +117,8 @@ public function searchDataProvider() {
117117
],
118118
// expected
119119
[
120-
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'],
121-
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'],
120+
[ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
121+
[ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
122122
],
123123
'',
124124
'files',
@@ -138,8 +138,8 @@ public function searchDataProvider() {
138138
],
139139
],
140140
[
141-
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'],
142-
[ 'id' => 'bobby', 'label' => 'Robert R.', 'source' => 'users'],
141+
[ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
142+
[ 'id' => 'bobby', 'label' => 'Robert R.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
143143
],
144144
'bob',
145145
'files',

tests/Core/Controller/LoginControllerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ public function testLoginWithInvalidCredentials() {
440440
->with('core.login.showLoginForm', [
441441
'user' => $user,
442442
'redirect_url' => '/apps/files',
443+
'direct' => 1,
443444
])
444445
->willReturn($loginPageUrl);
445446
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
@@ -597,6 +598,7 @@ public function testToNotLeakLoginName() {
597598
->with('core.login.showLoginForm', [
598599
'user' => 'john@doe.com',
599600
'redirect_url' => '/apps/files',
601+
'direct' => 1,
600602
])
601603
->willReturn($loginPageUrl);
602604
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);

tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
5252
/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
5353
private $userManager;
5454

55-
public function setUp() {
55+
public function setUp(): void {
5656
parent::setUp();
5757

5858
$this->rootFolder = $this->createMock(IRootFolder::class);

tests/Test/Repair/Owncloud/CleanPreviewsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CleanPreviewsTest extends TestCase {
4646
/** @var CleanPreviews */
4747
private $repair;
4848

49-
public function setUp() {
49+
public function setUp(): void {
5050
parent::setUp();
5151

5252
$this->jobList = $this->createMock(IJobList::class);

tests/Test/Repair/Owncloud/InstallCoreBundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class InstallCoreBundleTest extends TestCase {
4141
/** @var InstallCoreBundle */
4242
private $installCoreBundle;
4343

44-
public function setUp() {
44+
public function setUp(): void {
4545
parent::setUp();
4646
$this->bundleFetcher = $this->createMock(BundleFetcher::class);
4747
$this->config = $this->createMock(IConfig::class);

tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class UpdateLanguageCodesTest extends TestCase {
4343
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
4444
private $config;
4545

46-
protected function setUp() {
46+
protected function setUp(): void {
4747
parent::setUp();
4848

4949
$this->connection = \OC::$server->getDatabaseConnection();
@@ -86,6 +86,7 @@ public function testRun() {
8686
->from('preferences')
8787
->where($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
8888
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
89+
->orderBy('userid')
8990
->execute();
9091

9192
$rows = $result->fetchAll();

tests/phpunit-autotest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
>
99
<testsuite name='ownCloud'>
1010
<directory suffix='.php'>lib/</directory>
11-
<directory suffix='.php'>core/</directory>
12-
<directory suffix='.php'>ocs-provider/</directory>
11+
<directory suffix='.php'>Core/</directory>
12+
<directory suffix='.php'>Test/</directory>
1313
<file>apps.php</file>
1414
</testsuite>
1515
<!-- filters for code coverage -->
@@ -32,4 +32,3 @@
3232
<listener class="StartSessionListener" file="startsessionlistener.php" />
3333
</listeners>
3434
</phpunit>
35-

0 commit comments

Comments
 (0)