comments: Stop using a service alias for controller

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/38878/head
jld3103 3 years ago
parent 7250b98791
commit 4cd07d79a7
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      apps/comments/composer/composer/autoload_classmap.php
  2. 6
      apps/comments/composer/composer/autoload_static.php
  3. 3
      apps/comments/lib/AppInfo/Application.php
  4. 6
      apps/comments/lib/Controller/NotificationsController.php
  5. 5
      apps/comments/tests/Unit/AppInfo/ApplicationTest.php
  6. 6
      apps/comments/tests/Unit/Controller/NotificationsTest.php

@ -14,7 +14,7 @@ return array(
'OCA\\Comments\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
'OCA\\Comments\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
'OCA\\Comments\\Collaboration\\CommentersSorter' => $baseDir . '/../lib/Collaboration/CommentersSorter.php',
'OCA\\Comments\\Controller\\Notifications' => $baseDir . '/../lib/Controller/Notifications.php',
'OCA\\Comments\\Controller\\NotificationsController' => $baseDir . '/../lib/Controller/NotificationsController.php',
'OCA\\Comments\\EventHandler' => $baseDir . '/../lib/EventHandler.php',
'OCA\\Comments\\Listener\\CommentsEntityEventListener' => $baseDir . '/../lib/Listener/CommentsEntityEventListener.php',
'OCA\\Comments\\Listener\\LoadAdditionalScripts' => $baseDir . '/../lib/Listener/LoadAdditionalScripts.php',

@ -7,14 +7,14 @@ namespace Composer\Autoload;
class ComposerStaticInitComments
{
public static $prefixLengthsPsr4 = array (
'O' =>
'O' =>
array (
'OCA\\Comments\\' => 13,
),
);
public static $prefixDirsPsr4 = array (
'OCA\\Comments\\' =>
'OCA\\Comments\\' =>
array (
0 => __DIR__ . '/..' . '/../lib',
),
@ -29,7 +29,7 @@ class ComposerStaticInitComments
'OCA\\Comments\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
'OCA\\Comments\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
'OCA\\Comments\\Collaboration\\CommentersSorter' => __DIR__ . '/..' . '/../lib/Collaboration/CommentersSorter.php',
'OCA\\Comments\\Controller\\Notifications' => __DIR__ . '/..' . '/../lib/Controller/Notifications.php',
'OCA\\Comments\\Controller\\NotificationsController' => __DIR__ . '/..' . '/../lib/Controller/NotificationsController.php',
'OCA\\Comments\\EventHandler' => __DIR__ . '/..' . '/../lib/EventHandler.php',
'OCA\\Comments\\Listener\\CommentsEntityEventListener' => __DIR__ . '/..' . '/../lib/Listener/CommentsEntityEventListener.php',
'OCA\\Comments\\Listener\\LoadAdditionalScripts' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalScripts.php',

@ -28,7 +28,6 @@ namespace OCA\Comments\AppInfo;
use Closure;
use OCA\Comments\Capabilities;
use OCA\Comments\Controller\Notifications;
use OCA\Comments\EventHandler;
use OCA\Comments\Listener\CommentsEntityEventListener;
use OCA\Comments\Listener\LoadAdditionalScripts;
@ -58,8 +57,6 @@ class Application extends App implements IBootstrap {
public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);
$context->registerServiceAlias('NotificationsController', Notifications::class);
$context->registerEventListener(
LoadAdditionalScriptsEvent::class,
LoadAdditionalScripts::class

@ -38,11 +38,11 @@ use OCP\IUserSession;
use OCP\Notification\IManager;
/**
* Class Notifications
* Class NotificationsController
*
* @package OCA\Comments\Controller
*/
class Notifications extends Controller {
class NotificationsController extends Controller {
protected IRootFolder $rootFolder;
protected ICommentsManager $commentsManager;
@ -51,7 +51,7 @@ class Notifications extends Controller {
protected IUserSession $userSession;
/**
* Notifications constructor.
* NotificationsController constructor.
*/
public function __construct(
string $appName,

@ -51,11 +51,8 @@ class ApplicationTest extends TestCase {
$app = new Application();
$c = $app->getContainer();
// assert service instances in the container are properly setup
$s = $c->get('NotificationsController');
$this->assertInstanceOf('OCA\Comments\Controller\Notifications', $s);
$services = [
'OCA\Comments\Controller\NotificationsController',
'OCA\Comments\Activity\Filter',
'OCA\Comments\Activity\Listener',
'OCA\Comments\Activity\Provider',

@ -25,7 +25,7 @@
*/
namespace OCA\Comments\Tests\Unit\Controller;
use OCA\Comments\Controller\Notifications;
use OCA\Comments\Controller\NotificationsController;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\Comments\IComment;
@ -43,7 +43,7 @@ use OCP\Notification\INotification;
use Test\TestCase;
class NotificationsTest extends TestCase {
/** @var Notifications */
/** @var NotificationsController */
protected $notificationsController;
/** @var ICommentsManager|\PHPUnit\Framework\MockObject\MockObject */
@ -70,7 +70,7 @@ class NotificationsTest extends TestCase {
$this->notificationManager = $this->createMock(IManager::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->notificationsController = new Notifications(
$this->notificationsController = new NotificationsController(
'comments',
$this->createMock(IRequest::class),
$this->commentsManager,

Loading…
Cancel
Save