|
| 1 | +<?php |
| 2 | + |
| 3 | +it('creates the admin user', function () { |
| 4 | + $this->artisan('cachet:make:user', [ |
| 5 | + |
| 6 | + '--name' => 'Dan', |
| 7 | + '--admin' => true, |
| 8 | + '--password' => 'password', |
| 9 | + ]); |
| 10 | + |
| 11 | + $this->assertDatabaseHas('users', [ |
| 12 | + |
| 13 | + 'name' => 'Dan', |
| 14 | + 'is_admin' => true, |
| 15 | + ]); |
| 16 | +}); |
| 17 | + |
| 18 | +it('creates the standard user', function () { |
| 19 | + $this->artisan('cachet:make:user', [ |
| 20 | + |
| 21 | + '--name' => 'Dan', |
| 22 | + '--admin' => false, |
| 23 | + '--password' => 'password', |
| 24 | + ]); |
| 25 | + |
| 26 | + $this->assertDatabaseHas('users', [ |
| 27 | + |
| 28 | + 'name' => 'Dan', |
| 29 | + 'is_admin' => false, |
| 30 | + ]); |
| 31 | +}); |
| 32 | + |
| 33 | +it('creates the standard user using prompts', function () { |
| 34 | + $this->artisan('cachet:make:user') |
| 35 | + ->expectsQuestion('What is the user\'s name?', 'Dan') |
| 36 | + -> expectsQuestion( 'What is the user\'s email?', '[email protected]') |
| 37 | + ->expectsConfirmation('Is the user an admin?', 'No') |
| 38 | + ->expectsQuestion('What is the user\'s password?', 'password'); |
| 39 | + |
| 40 | + $this->assertDatabaseHas('users', [ |
| 41 | + |
| 42 | + 'name' => 'Dan', |
| 43 | + 'is_admin' => false, |
| 44 | + ]); |
| 45 | +}); |
| 46 | + |
| 47 | +it('creates the admin user using prompts', function () { |
| 48 | + $this->artisan('cachet:make:user') |
| 49 | + ->expectsQuestion('What is the user\'s name?', 'Dan') |
| 50 | + -> expectsQuestion( 'What is the user\'s email?', '[email protected]') |
| 51 | + ->expectsConfirmation('Is the user an admin?', 'Yes') |
| 52 | + ->expectsQuestion('What is the user\'s password?', 'password'); |
| 53 | + |
| 54 | + $this->assertDatabaseHas('users', [ |
| 55 | + |
| 56 | + 'name' => 'Dan', |
| 57 | + 'is_admin' => true, |
| 58 | + ]); |
| 59 | +}); |
0 commit comments