Skip to content

Commit

Permalink
Merge pull request #41094 from owncloud/fix/psr-test-namespace-2
Browse files Browse the repository at this point in the history
chore: set autoload-dev in composer.json
  • Loading branch information
phil-davis authored Nov 16, 2023
2 parents 27792a5 + 0af9128 commit a060b19
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 21 deletions.
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

},
"autoload-dev" : {
"psr-4": {
"Test\\": "tests/lib/",
"TestHelpers\\": "tests/TestHelpers/",
"Tests\\": "tests/"
},
"files": [
"tests/lib/TestCase.php"
]
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ parameters:
ignoreErrors:
- '#Undefined variable: \$OC_[a-zA-Z0-9\\_]+#'
- '#Undefined variable: \$vendor#'
- '#Instantiated class Test\\Util\\User\\Dummy not found.#'
# errors below are to be addressed by own pull requests - non trivial changes required
- '#Instantiated class OCA\\Encryption\\Crypto\\Crypt not found.#'
- '#Instantiated class OCA\\Encryption\\Util not found.#'
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Apps/AppsDisableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\Config;
namespace Tests\Core\Command\Apps;

use OC\Core\Command\App\Disable;
use Symfony\Component\Console\Tester\CommandTester;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Apps/AppsEnableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\Config;
namespace Tests\Core\Command\Apps;

use OC\Core\Command\App\Enable;
use Symfony\Component\Console\Tester\CommandTester;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Apps/AppsGetPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\Config;
namespace Tests\Core\Command\Apps;

use OC\Core\Command\App\GetPath;
use Symfony\Component\Console\Tester\CommandTester;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Apps/AppsListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\Config;
namespace Tests\Core\Command\Apps;

use OC\Core\Command\App\ListApps;
use Symfony\Component\Console\Tester\CommandTester;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Apps/CheckCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\Config;
namespace Tests\Core\Command\Apps;

use OC\App\InfoParser;
use OC\Core\Command\App\CheckCode;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Maintenance/RepairTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Tests\Core\Command\User;
namespace Tests\Core\Command\Maintenance;

use OC\Core\Command\Maintenance\Repair;
use Symfony\Component\Console\Application;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Controller/AppRegistryControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Core\Controller;
namespace Tests\Core\Controller;

use OC\Core\Controller\AppRegistryController;
use OC\Files\Node\File;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Controller/TwoFactorChallengeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

namespace Test\Core\Controller;
namespace Tests\Core\Controller;

use OC\Authentication\TwoFactorAuth\Manager;
use OC\Core\Controller\TwoFactorChallengeController;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Middleware/AccountModuleMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace Test\Core\Middleware;
namespace Tests\Core\Middleware;

use OC\Authentication\AccountModule\Manager;
use OC\Core\Controller\LoginController;
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Middleware/TwoFactorMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace Test\Core\Middleware;
namespace Tests\Core\Middleware;

use OC\AppFramework\Http\Request;
use OC\Authentication\TwoFactorAuth\Manager;
Expand Down
4 changes: 3 additions & 1 deletion tests/Core/Templates/TemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Tests\Core\Templates;

class TemplatesTest extends \Test\TestCase {
use Test\TestCase;

class TemplatesTest extends TestCase {
public function test403() {
$template = \OC::$SERVERROOT . '/core/templates/403.php';
$expectedHtml = "<ul><li class='error'>Access forbidden<br/><p class='hint'></p></li></ul>";
Expand Down
2 changes: 1 addition & 1 deletion tests/Settings/Controller/AuthSettingsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

namespace Test\Settings\Controller;
namespace Tests\Settings\Controller;

use OC\AppFramework\Http;
use OC\Authentication\Exceptions\InvalidTokenException;
Expand Down
4 changes: 0 additions & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
// especially with code coverage it will require some more time
\set_time_limit(0);

\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);
\OC::$composerAutoloader->addPsr4('TestHelpers\\', OC::$SERVERROOT . '/tests/TestHelpers/', true);
\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);

// load all enabled apps
\OC_App::loadApps();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
*
*/

namespace Test;
namespace Test\Settings;

use OC\Settings\SettingsManager;
use OCP\License\ILicenseManager;
use Test\TestCase;

class SettingsManagerTest extends TestCase {
/** @var \OC\Settings\SettingsManager */
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Share/Filters/MailNotificationFilterTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Test\Share;
namespace Test\Share\Filters;

use OC\Share\Filters\MailNotificationFilter;
use Test\TestCase;
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Shutdown/ShutdownManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
*
*/

namespace Tests\Shutdown;
namespace Test\Shutdown;

use OC\Shutdown\ShutDownManager;
use Test\TestCase;

class ShutdownManagerTest extends TestCase {
public function testOrderedRun() {
public function testOrderedRun(): void {
/** @var ShutDownManager $manager */
$manager = $this->getMockBuilder(ShutDownManager::class)
->disableOriginalConstructor()
Expand Down

0 comments on commit a060b19

Please sign in to comment.