diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-10-28 21:56:43 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-10-28 23:10:23 +0100 |
commit | 765ee60eeacc8f9f41cb145b67821a192330daea (patch) | |
tree | 931f30c803c8f613be73e61159c2930ff1037e2b /tests | |
parent | e4f53ff91b985123b171dc23db8246c017af46f6 (diff) | |
download | nextcloud-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.php | 14 |
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++; }); |