Merge pull request #26276 from nextcloud/backport/26265/stable21

[stable21] Fix casing of core test folder, bring back missing tests
This commit is contained in:
Morris Jobke 2021-03-24 17:13:44 +01:00 committed by GitHub
commit ba9e1c0d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 33 deletions

View File

@ -68,18 +68,18 @@ class AppsDisableTest extends TestCase {
public function dataCommandInput(): array { public function dataCommandInput(): array {
return [ return [
[['admin_audit'], 0, 'admin_audit 1.10.0 disabled'], [['admin_audit'], 0, 'admin_audit 1.11.0 disabled'],
[['comments'], 0, 'comments 1.10.0 disabled'], [['comments'], 0, 'comments 1.11.0 disabled'],
[['invalid_app'], 0, 'No such app enabled: invalid_app'], [['invalid_app'], 0, 'No such app enabled: invalid_app'],
[['admin_audit', 'comments'], 0, "admin_audit 1.10.0 disabled\ncomments 1.10.0 disabled"], [['admin_audit', 'comments'], 0, "admin_audit 1.11.0 disabled\ncomments 1.11.0 disabled"],
[['admin_audit', 'comments', 'invalid_app'], 0, "admin_audit 1.10.0 disabled\ncomments 1.10.0 disabled\nNo such app enabled: invalid_app"], [['admin_audit', 'comments', 'invalid_app'], 0, "admin_audit 1.11.0 disabled\ncomments 1.11.0 disabled\nNo such app enabled: invalid_app"],
[['files'], 2, "files can't be disabled"], [['files'], 2, "files can't be disabled"],
[['provisioning_api'], 2, "provisioning_api can't be disabled"], [['provisioning_api'], 2, "provisioning_api can't be disabled"],
[['files', 'admin_audit'], 2, "files can't be disabled.\nadmin_audit 1.10.0 disabled"], [['files', 'admin_audit'], 2, "files can't be disabled.\nadmin_audit 1.11.0 disabled"],
[['provisioning_api', 'comments'], 2, "provisioning_api can't be disabled.\ncomments 1.10.0 disabled"], [['provisioning_api', 'comments'], 2, "provisioning_api can't be disabled.\ncomments 1.11.0 disabled"],
]; ];
} }

View File

@ -73,28 +73,28 @@ class AppsEnableTest extends TestCase {
public function dataCommandInput(): array { public function dataCommandInput(): array {
$data = [ $data = [
[['admin_audit'], null, 0, 'admin_audit 1.10.0 enabled'], [['admin_audit'], null, 0, 'admin_audit 1.11.0 enabled'],
[['comments'], null, 0, 'comments 1.10.0 enabled'], [['comments'], null, 0, 'comments 1.11.0 enabled'],
[['comments', 'comments'], null, 0, "comments 1.10.0 enabled\ncomments already enabled"], [['comments', 'comments'], null, 0, "comments 1.11.0 enabled\ncomments already enabled"],
[['invalid_app'], null, 1, 'Could not download app invalid_app'], [['invalid_app'], null, 1, 'Could not download app invalid_app'],
[['admin_audit', 'comments'], null, 0, "admin_audit 1.10.0 enabled\ncomments 1.10.0 enabled"], [['admin_audit', 'comments'], null, 0, "admin_audit 1.11.0 enabled\ncomments 1.11.0 enabled"],
[['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit 1.10.0 enabled\ncomments 1.10.0 enabled\nCould not download app invalid_app"], [['admin_audit', 'comments', 'invalid_app'], null, 1, "admin_audit 1.11.0 enabled\ncomments 1.11.0 enabled\nCould not download app invalid_app"],
[['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"], [['admin_audit'], ['admin'], 1, "admin_audit can't be enabled for groups"],
[['comments'], ['admin'], 1, "comments can't be enabled for groups"], [['comments'], ['admin'], 1, "comments can't be enabled for groups"],
[['updatenotification'], ['admin'], 0, 'updatenotification 1.10.0 enabled for groups: admin'], [['updatenotification'], ['admin'], 0, 'updatenotification 1.11.0 enabled for groups: admin'],
[['updatenotification', 'accessibility'], ['admin'], 0, "updatenotification 1.10.0 enabled for groups: admin\naccessibility 1.6.0 enabled for groups: admin"], [['updatenotification', 'accessibility'], ['admin'], 0, "updatenotification 1.11.0 enabled for groups: admin\naccessibility 1.7.0 enabled for groups: admin"],
[['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification 1.10.0 enabled for groups: admin'], [['updatenotification'], ['admin', 'invalid_group'], 0, 'updatenotification 1.11.0 enabled for groups: admin'],
[['updatenotification', 'accessibility'], ['admin', 'invalid_group'], 0, "updatenotification 1.10.0 enabled for groups: admin\naccessibility 1.6.0 enabled for groups: admin"], [['updatenotification', 'accessibility'], ['admin', 'invalid_group'], 0, "updatenotification 1.11.0 enabled for groups: admin\naccessibility 1.7.0 enabled for groups: admin"],
[['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"], [['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"],
]; ];
if (getenv('CI') === false) { if (getenv('CI') === false) {
/** Tests disabled on drone/ci due to appstore dependency */ /** Tests disabled on drone/ci due to appstore dependency */
$data[] = [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification 1.10.0 enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"]; $data[] = [['updatenotification', 'contacts'], ['admin'], 0, "updatenotification 1.11.0 enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"];
$data[] = [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"]; $data[] = [['updatenotification', 'contacts'], ['admin', 'invalid_group'], 0, "updatenotification enabled for groups: admin\ncontacts 3.3.0 enabled for groups: admin"];
$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"]; $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"];
} }

View File

@ -9,6 +9,7 @@ use OCP\Files\IRootFolder;
use OCP\Files\Node; use OCP\Files\Node;
use OCP\IConfig; use OCP\IConfig;
use OCP\ILogger; use OCP\ILogger;
use OCP\Lock\ILockingProvider;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -43,7 +44,13 @@ class RepairTest extends TestCase {
->getMock(); ->getMock();
$this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class) $this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)
->getMock(); ->getMock();
$this->repair = new Repair($this->config, $this->rootFolder, $this->logger, $this->iniGetWrapper); $this->repair = new Repair(
$this->config,
$this->rootFolder,
$this->logger,
$this->iniGetWrapper,
$this->createMock(ILockingProvider::class)
);
$this->input = $this->getMockBuilder(InputInterface::class) $this->input = $this->getMockBuilder(InputInterface::class)
->getMock(); ->getMock();
$this->input->expects($this->any()) $this->input->expects($this->any())

View File

@ -75,8 +75,8 @@ class AutoCompleteControllerTest extends TestCase {
], ],
// expected // expected
[ [
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'], [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'], [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
], ],
'', '',
'files', 'files',
@ -96,8 +96,8 @@ class AutoCompleteControllerTest extends TestCase {
], ],
// expected // expected
[ [
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'], [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'], [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
], ],
'', '',
null, null,
@ -117,8 +117,8 @@ class AutoCompleteControllerTest extends TestCase {
], ],
// expected // expected
[ [
[ 'id' => 'alice', 'label' => 'Alice A.', 'source' => 'users'], [ 'id' => 'alice', 'label' => 'Alice A.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'], [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
], ],
'', '',
'files', 'files',
@ -138,8 +138,8 @@ class AutoCompleteControllerTest extends TestCase {
], ],
], ],
[ [
[ 'id' => 'bob', 'label' => 'Bob Y.', 'source' => 'users'], [ 'id' => 'bob', 'label' => 'Bob Y.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
[ 'id' => 'bobby', 'label' => 'Robert R.', 'source' => 'users'], [ 'id' => 'bobby', 'label' => 'Robert R.', 'icon' => '', 'source' => 'users', 'status' => '', 'subline' => ''],
], ],
'bob', 'bob',
'files', 'files',

View File

@ -440,6 +440,7 @@ class LoginControllerTest extends TestCase {
->with('core.login.showLoginForm', [ ->with('core.login.showLoginForm', [
'user' => $user, 'user' => $user,
'redirect_url' => '/apps/files', 'redirect_url' => '/apps/files',
'direct' => 1,
]) ])
->willReturn($loginPageUrl); ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);
@ -597,6 +598,7 @@ class LoginControllerTest extends TestCase {
->with('core.login.showLoginForm', [ ->with('core.login.showLoginForm', [
'user' => 'john@doe.com', 'user' => 'john@doe.com',
'redirect_url' => '/apps/files', 'redirect_url' => '/apps/files',
'direct' => 1,
]) ])
->willReturn($loginPageUrl); ->willReturn($loginPageUrl);
$expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl);

View File

@ -52,7 +52,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */ /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
private $userManager; private $userManager;
public function setUp() { public function setUp(): void {
parent::setUp(); parent::setUp();
$this->rootFolder = $this->createMock(IRootFolder::class); $this->rootFolder = $this->createMock(IRootFolder::class);

View File

@ -46,7 +46,7 @@ class CleanPreviewsTest extends TestCase {
/** @var CleanPreviews */ /** @var CleanPreviews */
private $repair; private $repair;
public function setUp() { public function setUp(): void {
parent::setUp(); parent::setUp();
$this->jobList = $this->createMock(IJobList::class); $this->jobList = $this->createMock(IJobList::class);

View File

@ -41,7 +41,7 @@ class InstallCoreBundleTest extends TestCase {
/** @var InstallCoreBundle */ /** @var InstallCoreBundle */
private $installCoreBundle; private $installCoreBundle;
public function setUp() { public function setUp(): void {
parent::setUp(); parent::setUp();
$this->bundleFetcher = $this->createMock(BundleFetcher::class); $this->bundleFetcher = $this->createMock(BundleFetcher::class);
$this->config = $this->createMock(IConfig::class); $this->config = $this->createMock(IConfig::class);

View File

@ -43,7 +43,7 @@ class UpdateLanguageCodesTest extends TestCase {
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
private $config; private $config;
protected function setUp() { protected function setUp(): void {
parent::setUp(); parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection(); $this->connection = \OC::$server->getDatabaseConnection();
@ -86,6 +86,7 @@ class UpdateLanguageCodesTest extends TestCase {
->from('preferences') ->from('preferences')
->where($qb->expr()->eq('appid', $qb->createNamedParameter('core'))) ->where($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang'))) ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
->orderBy('userid')
->execute(); ->execute();
$rows = $result->fetchAll(); $rows = $result->fetchAll();

View File

@ -8,8 +8,8 @@
> >
<testsuite name='ownCloud'> <testsuite name='ownCloud'>
<directory suffix='.php'>lib/</directory> <directory suffix='.php'>lib/</directory>
<directory suffix='.php'>core/</directory> <directory suffix='.php'>Core/</directory>
<directory suffix='.php'>ocs-provider/</directory> <directory suffix='.php'>Test/</directory>
<file>apps.php</file> <file>apps.php</file>
</testsuite> </testsuite>
<!-- filters for code coverage --> <!-- filters for code coverage -->
@ -32,4 +32,3 @@
<listener class="StartSessionListener" file="startsessionlistener.php" /> <listener class="StartSessionListener" file="startsessionlistener.php" />
</listeners> </listeners>
</phpunit> </phpunit>