-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathResourceTest.php
More file actions
80 lines (61 loc) · 1.74 KB
/
ResourceTest.php
File metadata and controls
80 lines (61 loc) · 1.74 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ResourceTest extends TestCase {
use DatabaseTransactions;
protected $title = 'Curso de interfaces dinámicas con Laravel y jQuery';
protected $link = 'https://styde.net/curso-de-interfaces-dinamicas-con-laravel-y-jquery/';
/**
* A basic functional test example.
*
* @return void
*/
public function test_create_resource()
{
// Having
$user = seed('User');
// When
$this->actingAs($user)
->visit(route('tickets.create'))
->type($this->title, 'title')
->type($this->link, 'link')
->press('Enviar solicitud');
// Then
$this->seeInDatabase('tickets', [
'title' => $this->title,
'link' => $this->link,
'status' => 'closed',
]);
$this->see($this->title)
->seeLink('Ver recurso', $this->link);
}
public function test_select_resource()
{
// Having
$user = seed('User');
$ticket = seed('Ticket',[
'title' => $this->title,
'user_id' => $user->id,
'status' => 'open'
]);
$comment = seed('TicketComment',[
'ticket_id' => $ticket->id,
'link' => $this->link,
]);
// When
$this->actingAs($user)
->visit(route('tickets.details', $ticket))
->press('Seleccionar tutorial');
// Then
$this->seeInDatabase('tickets',[
'id' => $ticket->id,
'status' => 'closed',
'link' => $this->link,
]);
$this->seeInDatabase('ticket_comments', [
'id' => $comment->id,
'selected' => true
]);
$this->seePageIs(route('tickets.details', $ticket));
$this->seeLink('Ver recurso', $this->link);
}
}