Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Feb 11, 2022
commit e485451eeda633e0dfa1bff619384d413a8bab3f
27 changes: 27 additions & 0 deletions tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand Down Expand Up @@ -163,6 +164,32 @@ public function testRegisterMiddleware(): void {
]);
}

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],
Expand Down