CreateUserTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 22
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateUser_() 0 18 1
1
<?php
2
3
namespace App\Containers\User\Tests\Unit;
4
5
use App\Containers\User\Models\User;
6
use App\Containers\User\Actions\CreateUserAction;
7
use App\Containers\User\Tests\TestCase;
8
use Illuminate\Support\Facades\App;
9
10
/**
11
 * Class CreateUserTest.
12
 *
13
 * @author Mahmoud Zalt <[email protected]>
14
 */
15
class CreateUserTest extends TestCase
16
{
17
18
    public function testCreateUser_()
19
    {
20
        $task = App::make(CreateUserAction::class);
21
22
        $email = '[email protected]';
23
        $name = 'Mahmoud';
24
        $password = 'so-secret';
25
26
        $user = $task->run($email, $password, $name, null, null, true);
27
28
        // asset the returned object is an instance of the User
29
        $this->assertInstanceOf(User::class, $user);
30
31
        // assert the user has logged in and has a token attached to it
32
        $this->assertNotEmpty($user->token);
33
34
        $this->assertEquals($user->name, $name);
35
    }
36
}
37