diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-02-11 23:33:55 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-02-11 23:34:25 +0000 |
commit | e485451eeda633e0dfa1bff619384d413a8bab3f (patch) | |
tree | 3af809b7bd15cf598d2f769d5211b6eb2d92faea /tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php | |
parent | 21f9e85e1a2ae6c57ec34c8f4c202250caa68337 (diff) | |
download | nextcloud-server-e485451eeda633e0dfa1bff619384d413a8bab3f.tar.gz nextcloud-server-e485451eeda633e0dfa1bff619384d413a8bab3f.zip |
Add test
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php')
-rw-r--r-- | tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php index 067e9a09673..81fac49348b 100644 --- a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php +++ b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace lib\AppFramework\Bootstrap; use OC\AppFramework\Bootstrap\RegistrationContext; +use OC\AppFramework\Bootstrap\ServiceRegistration; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; use OCP\EventDispatcher\IEventDispatcher; @@ -163,6 +164,32 @@ class RegistrationContextTest extends TestCase { ]); } + public function testRegisterUserMigrator(): void { + $appIdA = 'myapp'; + $migratorClassA = 'OCA\App\UserMigration\AppMigrator'; + + $appIdB = 'otherapp'; + $migratorClassB = 'OCA\OtherApp\UserMigration\OtherAppMigrator'; + + $serviceRegistrationA = new ServiceRegistration($appIdA, $migratorClassA); + $serviceRegistrationB = new ServiceRegistration($appIdB, $migratorClassB); + + $this->context + ->for($appIdA) + ->registerUserMigrator($migratorClassA); + $this->context + ->for($appIdB) + ->registerUserMigrator($migratorClassB); + + $this->assertEquals( + [ + $serviceRegistrationA, + $serviceRegistrationB, + ], + $this->context->getUserMigrators(), + ); + } + public function dataProvider_TrueFalse() { return[ [true], |