Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit f967607

Browse files
committed
Added Importer test
1 parent 145e7d6 commit f967607

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/DatabaseImporterTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Adldap\Laravel\Tests;
4+
5+
use Adldap\Laravel\Auth\Importer;
6+
use Adldap\Laravel\Tests\Models\User;
7+
use Illuminate\Support\Facades\Hash;
8+
9+
class DatabaseImporterTest extends DatabaseTestCase
10+
{
11+
public function test_run()
12+
{
13+
$user = $this->makeLdapUser([
14+
'cn' => 'John Doe',
15+
'userprincipalname' => 'jdoe@email.com',
16+
]);
17+
18+
$importer = new Importer();
19+
20+
$model = $importer->run($user, new User(), ['password' => 'password']);
21+
22+
$this->assertEquals($user->getCommonName(), $model->name);
23+
$this->assertEquals($user->getUserPrincipalName(), $model->email);
24+
$this->assertTrue(Hash::check('password', $model->password));
25+
}
26+
}

0 commit comments

Comments
 (0)