forked from laravel/quickstart-basic
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathExampleTest.php
More file actions
45 lines (34 loc) · 1.04 KB
/
ExampleTest.php
File metadata and controls
45 lines (34 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use App\Task;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
use DatabaseTransactions;
public function test_tasks_are_displayed_on_the_dashboard()
{
factory(Task::class)->create(['name' => 'Task 1']);
factory(Task::class)->create(['name' => 'Task 2']);
factory(Task::class)->create(['name' => 'Task 3']);
$this->visit('/')
->see('Task 1')
->see('Task 2')
->see('Task 3');
}
public function test_tasks_can_be_created()
{
$this->visit('/')->dontSee('Task 1');
$this->visit('/')
->type('Task 1', 'name')
->press('Add Task')
->see('Task 1');
}
public function test_long_tasks_cant_be_created()
{
$this->visit('/')
->type(str_random(300), 'name')
->press('Add Task')
->see('Whoops!');
}
}