|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hipanel\modules\ticket\tests\acceptance\client; |
|
4
|
|
|
|
|
5
|
|
|
use Codeception\Scenario; |
|
6
|
|
|
use hipanel\modules\ticket\tests\_support\ticket\Create; |
|
7
|
|
|
use hipanel\modules\ticket\tests\_support\ticket\Index; |
|
8
|
|
|
use hipanel\modules\ticket\tests\_support\ticket\View; |
|
9
|
|
|
use hipanel\tests\_support\Step\Acceptance\Client; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class TicketCest |
|
13
|
|
|
* |
|
14
|
|
|
* @author Dmytro Naumenko <[email protected]> |
|
15
|
|
|
*/ |
|
16
|
|
|
class TicketCest |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var string|int |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $ticket_id; |
|
22
|
|
|
|
|
23
|
|
|
public function ensureIndexPageWorks(Client $I) |
|
24
|
|
|
{ |
|
25
|
|
|
(new Index($I))->ensurePageWorks(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function ensureICanNavigateToCreateTicketPage(Client $I) |
|
29
|
|
|
{ |
|
30
|
|
|
(new Index($I))->ensureThatICanNavigateToCreateTicketPage(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function ensureICanCreateTicket(Client $I) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->ticket_id = (new Create($I))->createTicket( |
|
36
|
|
|
'Test ticket (' . date('Y-m-d H:i') . ')', |
|
37
|
|
|
'This is a test ticket created by automated testing system. Ignore it, please.', |
|
38
|
|
|
'General question' |
|
39
|
|
|
); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function ensureISeeCreatedTicketOnIndexPage(Client $I, Scenario $scenario) |
|
43
|
|
|
{ |
|
44
|
|
|
if (!isset($this->ticket_id)) { |
|
45
|
|
|
$scenario->incomplete('Ticket ID must be filled to run this test'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
$index = new Index($I); |
|
49
|
|
|
$index->hasLinkToTicket($this->ticket_id); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function ensureICanCommentTicket(Client $I, Scenario $scenario) |
|
53
|
|
|
{ |
|
54
|
|
|
if (!isset($this->ticket_id)) { |
|
55
|
|
|
$scenario->incomplete('Ticket ID must be filled to run this test'); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$view = new View($I, $this->ticket_id); |
|
59
|
|
|
$view->visitTicket(); |
|
60
|
|
|
$view->postComment('This is a test comment. Ignore it, please.'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function ensureICanChangeTicketState(Client $I, Scenario $scenario) |
|
64
|
|
|
{ |
|
65
|
|
|
if (!isset($this->ticket_id)) { |
|
66
|
|
|
$scenario->incomplete('Ticket ID must be filled to run this test'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
$view = new View($I, $this->ticket_id); |
|
70
|
|
|
$view->visitTicket(); |
|
71
|
|
|
$view->closeTicket(); |
|
72
|
|
|
|
|
73
|
|
|
$I->openNewTab(); |
|
74
|
|
|
$index = new Index($I); |
|
75
|
|
|
$index->hasntLinkToTicket($this->ticket_id); |
|
76
|
|
|
$I->closeTab(); |
|
77
|
|
|
|
|
78
|
|
|
$view->openTicket(); |
|
79
|
|
|
$view->closeTicket(); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|