'
+ . ''
+ . Lang::get('This link will expire in :count minutes.', ['count' => self::VAR_ACTION_LINK_EXPIRATION])
+ . '
'
+ . ''
+ )
+ ];
+ }
+}
diff --git a/src/EscolaLmsTemplatesEmailServiceProvider.php b/src/EscolaLmsTemplatesEmailServiceProvider.php
index e6b6028..8d032b8 100644
--- a/src/EscolaLmsTemplatesEmailServiceProvider.php
+++ b/src/EscolaLmsTemplatesEmailServiceProvider.php
@@ -7,6 +7,7 @@
use EscolaLms\TemplatesEmail\Providers\AuthTemplatesEventServiceProvider;
use EscolaLms\TemplatesEmail\Providers\AuthTemplatesServiceProvider;
use EscolaLms\TemplatesEmail\Providers\CourseTemplatesServiceProvider;
+use EscolaLms\TemplatesEmail\Providers\CsvUsersTemplatesServiceProvider;
use EscolaLms\TemplatesEmail\Rules\MjmlRule;
use EscolaLms\TemplatesEmail\Services\Contracts\MjmlServiceContract;
use EscolaLms\TemplatesEmail\Services\MjmlService;
@@ -37,6 +38,9 @@ public function register()
if (class_exists(\EscolaLms\Courses\EscolaLmsCourseServiceProvider::class)) {
$this->app->register(CourseTemplatesServiceProvider::class);
}
+ if (class_exists(\EscolaLms\CsvUsers\EscolaLmsCsvUsersServiceProvider::class)) {
+ $this->app->register(CsvUsersTemplatesServiceProvider::class);
+ }
}
public function boot()
diff --git a/src/Providers/CsvUsersTemplatesServiceProvider.php b/src/Providers/CsvUsersTemplatesServiceProvider.php
new file mode 100644
index 0000000..b0865b6
--- /dev/null
+++ b/src/Providers/CsvUsersTemplatesServiceProvider.php
@@ -0,0 +1,17 @@
+markTestSkipped('Auth package not installed');
+ }
+ }
+
+ public function testImportNewUserNotification(): void
+ {
+ Notification::fake();
+ Event::fake();
+ Mail::fake();
+
+ $userToImport = collect([
+ 'email' => 'import.user@poczta.com',
+ 'first_name' => 'Import',
+ 'last_name' => 'User',
+ ]);
+
+ $service = app(CsvUserServiceContract::class);
+ $user = $service->saveUserFromImport($userToImport, 'http://localhost/set-password');
+
+ Event::assertDispatched(EscolaLmsImportedNewUserTemplateEvent::class,
+ function (EscolaLmsImportedNewUserTemplateEvent $event) use ($userToImport) {
+ return $event->getUser()->email === $userToImport['email'];
+ });
+
+ $listener = app(TemplateEventListener::class);
+ $listener->handle(new EscolaLmsImportedNewUserTemplateEvent($user,'http://localhost/set-password'));
+
+ Mail::assertSent(EmailMailable::class, function (EmailMailable $mailable) use ($user) {
+ $this->assertEquals('User Import Notification', $mailable->subject);
+ $this->assertTrue($mailable->hasTo($user->email));
+ $this->assertStringContainsString('token=' . $user->password_reset_token, $mailable->getHtml());
+ $this->assertStringContainsString('email=' . $user->email, $mailable->getHtml());
+ $this->assertStringContainsString('http://localhost/set-password', $mailable->getHtml());
+ return true;
+ });
+ }
+}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 9774526..b79fb2e 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -7,6 +7,7 @@
use EscolaLms\Auth\Tests\Models\Client;
use EscolaLms\Core\Tests\TestCase as CoreTestCase;
use EscolaLms\Courses\EscolaLmsCourseServiceProvider;
+use EscolaLms\CsvUsers\EscolaLmsCsvUsersServiceProvider;
use EscolaLms\Scorm\EscolaLmsScormServiceProvider;
use EscolaLms\Settings\EscolaLmsSettingsServiceProvider;
use EscolaLms\Templates\EscolaLmsTemplatesServiceProvider;
@@ -58,6 +59,9 @@ protected function getPackageProviders($app)
if (class_exists(\EscolaLms\Settings\EscolaLmsSettingsServiceProvider::class)) {
$providers[] = EscolaLmsSettingsServiceProvider::class;
}
+ if (class_exists(\EscolaLms\CsvUsers\EscolaLmsCsvUsersServiceProvider::class)) {
+ $providers[] = EscolaLmsCsvUsersServiceProvider::class;
+ }
return $providers;
}