summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-28 21:56:43 +0100
committerMorris Jobke <hey@morrisjobke.de>2020-10-28 23:10:23 +0100
commit765ee60eeacc8f9f41cb145b67821a192330daea (patch)
tree931f30c803c8f613be73e61159c2930ff1037e2b /tests
parente4f53ff91b985123b171dc23db8246c017af46f6 (diff)
downloadnextcloud-server-765ee60eeacc8f9f41cb145b67821a192330daea.tar.gz
nextcloud-server-765ee60eeacc8f9f41cb145b67821a192330daea.zip
Change tests to typed event listener
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/SubAdminTest.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php
index 0ca2b11679d..a3a795ce392 100644
--- a/tests/lib/SubAdminTest.php
+++ b/tests/lib/SubAdminTest.php
@@ -22,6 +22,8 @@
namespace Test;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Group\Events\SubAdminAddedEvent;
+use OCP\Group\Events\SubAdminRemovedEvent;
/**
* @group DB
@@ -282,15 +284,15 @@ class SubAdminTest extends \Test\TestCase {
$g = $this->groups[0];
$count = 0;
- $subAdmin->listen('\OC\SubAdmin', 'postCreateSubAdmin', function ($user, $group) use ($test, $u, $g, &$count) {
- $test->assertEquals($u->getUID(), $user->getUID());
- $test->assertEquals($g->getGID(), $group->getGID());
+ $this->eventDispatcher->addListener(SubAdminAddedEvent::class, function (SubAdminAddedEvent $event) use ($test, $u, $g, &$count) {
+ $test->assertEquals($u->getUID(), $event->getUser()->getUID());
+ $test->assertEquals($g->getGID(), $event->getGroup()->getGID());
$count++;
});
- $subAdmin->listen('\OC\SubAdmin', 'postDeleteSubAdmin', function ($user, $group) use ($test, $u, $g, &$count) {
- $test->assertEquals($u->getUID(), $user->getUID());
- $test->assertEquals($g->getGID(), $group->getGID());
+ $this->eventDispatcher->addListener(SubAdminRemovedEvent::class, function ($event) use ($test, $u, $g, &$count) {
+ $test->assertEquals($u->getUID(), $event->getUser()->getUID());
+ $test->assertEquals($g->getGID(), $event->getGroup()->getGID());
$count++;
});