-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bfa713
commit e7a8599
Showing
10 changed files
with
179 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,22 +11,35 @@ class PersosTableSeeder extends Seeder | |
*/ | ||
public function run() | ||
{ | ||
$user1 = DB::table('users') | ||
->where('email', '=', '[email protected]') | ||
->select('id')->first(); | ||
$user2 = DB::table('users') | ||
->where('email', '=', '[email protected]') | ||
->select('id')->first(); | ||
$now = date('Y-m-d H:i:s'); | ||
DB::table('persos')->insert([ | ||
'nom' => 'Hémihéli', | ||
'race' => 'Humain', | ||
'user_id' => '1' | ||
'user_id' => $user1->id, | ||
'created_at' => $now, | ||
'updated_at' => $now | ||
]); | ||
|
||
DB::table('persos')->insert([ | ||
'nom' => 'Kheldom', | ||
'race' => 'Fée', | ||
'user_id' => '1' | ||
'user_id' => $user1->id, | ||
'created_at' => $now, | ||
'updated_at' => $now | ||
]); | ||
|
||
DB::table('persos')->insert([ | ||
'nom' => 'Pluhm', | ||
'race' => 'Elfe', | ||
'user_id' => '2' | ||
'user_id' => $user2->id, | ||
'created_at' => $now, | ||
'updated_at' => $now | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,13 @@ class UsersTableSeeder extends Seeder | |
public function run() | ||
{ | ||
DB::table('users')->insert([ | ||
'name' => 'User '.str_random(10), | ||
'name' => 'User 1', | ||
'email' => '[email protected]', | ||
'password' => bcrypt('secret'), | ||
]); | ||
|
||
DB::table('users')->insert([ | ||
'name' => 'User '.str_random(10), | ||
'name' => 'User 2', | ||
'email' => '[email protected]', | ||
'password' => bcrypt('secret'), | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
use Illuminate\Foundation\Testing\WithoutMiddleware; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Illuminate\Foundation\Testing\DatabaseTransactions; | ||
|
||
class HJTest extends TestCase | ||
{ | ||
use DatabaseMigrations; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->artisan('migrate:refresh', [ | ||
'--seed' => '1' | ||
]); | ||
} | ||
|
||
public function testCreateAccount() | ||
{ | ||
$this->visit('/') | ||
->see('Utopya') | ||
->see('Créer un compte') | ||
->click('Créer un compte') | ||
->seePageIs('/register') | ||
->type('Taylor', 'name') | ||
->type('[email protected]', 'email') | ||
->type('secret', 'password') | ||
->type('secret', 'password_confirmation') | ||
->press('Se connecter') | ||
->seePageIs('/home') | ||
->see('Taylor') | ||
->seeInDatabase('users', [ | ||
'email' => '[email protected]' | ||
]); | ||
} | ||
|
||
public function testLogIn() | ||
{ | ||
$this->visit('/') | ||
->seeInDatabase('users', [ | ||
'email' => '[email protected]' | ||
]) | ||
->see('Utopya') | ||
->see('Login') | ||
->click('Login') | ||
->seePageIs('/login') | ||
->type('[email protected]', 'email') | ||
->type('secret', 'password') | ||
->check('remember'); | ||
$this->press('Se connecter') | ||
->seePageIs('/home') | ||
->see('User 1'); | ||
} | ||
|
||
public function testLogInWithUnknownUser() | ||
{ | ||
$this->visit('/') | ||
->see('Utopya') | ||
->see('Login') | ||
->click('Login') | ||
->seePageIs('/login') | ||
->type('[email protected]', 'email') | ||
->type('secret', 'password') | ||
->check('remember'); | ||
$this->press('Se connecter') | ||
->seePageIs('/login') | ||
->see('Ces identifiants ne correspondent pas à nos enregistrements'); | ||
} | ||
|
||
public function testCreatePerso() | ||
{ | ||
$user = factory(App\User::class)->create(); | ||
$this->actingAs($user) | ||
->visit('/home') | ||
->see($user->name) | ||
->click('Nouveau personnage') | ||
->seePageIs('persos/create') | ||
->type('Elfe chadiv', 'nom') | ||
->select('Elfe', 'race') | ||
->press('Créer') | ||
->seePageIs('home') | ||
->see('Elfe chadiv'); | ||
} | ||
|
||
public function testCreateExistingPerso() | ||
{ | ||
$user = factory(App\User::class)->create(); | ||
$this->actingAs($user) | ||
->visit('/home') | ||
->see($user->name) | ||
->click('Nouveau personnage') | ||
->seePageIs('persos/create') | ||
->type('Kheldom', 'nom') | ||
->select('Elfe', 'race') | ||
->press('Créer') | ||
->seePageIs('persos/create') | ||
->see('La valeur du champ nom est déjà utilisée.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters