|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Registration must be public |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
class RegistrationCest extends CestCase |
|
8
|
|
|
{ |
|
9
|
|
|
|
|
10
|
|
|
private $successVisitor = [ |
|
11
|
|
|
'fields' => [ |
|
12
|
|
|
'name' => 'robo', |
|
13
|
|
|
'surname' => 'Černík', |
|
14
|
|
|
'nick' => 'roboTester', |
|
15
|
|
|
'email' => '[email protected]', |
|
16
|
|
|
'birthday' => '27.04.1976', |
|
17
|
|
|
'street' => 'Testovací 32', |
|
18
|
|
|
'city' => 'Testákov 4', |
|
19
|
|
|
'postal_code' => '98765', |
|
20
|
|
|
'group_num' => '1A2.34', |
|
21
|
|
|
'group_name' => 'Testeři', |
|
22
|
|
|
'troop_name' => 'klikači', |
|
23
|
|
|
'arrival' => 'Někdy', |
|
24
|
|
|
'departure' => 'jindy', |
|
25
|
|
|
'comment' => 'než', |
|
26
|
|
|
'question' => 'právě', |
|
27
|
|
|
'question2' => 'teď!', |
|
28
|
|
|
], |
|
29
|
|
|
'options' => [ |
|
30
|
|
|
'province' => 'Hlavní město Praha', |
|
31
|
|
|
'fry_dinner' => 'ano', |
|
32
|
|
|
'sat_breakfast' => 'ne', |
|
33
|
|
|
'sat_lunch' => 'ano', |
|
34
|
|
|
'sat_dinner' => 'ne', |
|
35
|
|
|
'sun_breakfast' => 'ano', |
|
36
|
|
|
'sun_lunch' => 'ne', |
|
37
|
|
|
], |
|
38
|
|
|
]; |
|
39
|
|
|
|
|
40
|
|
|
private $successRegistrationUri; |
|
41
|
|
|
private $succeededRegistrationUrl = '~/srazvs/registration/check/[a-z0-9]*~'; |
|
42
|
|
|
private $updatedRegistrationUrl = '~/srazvs/registration/update/[a-z0-9]*~'; |
|
|
|
|
|
|
43
|
|
|
|
|
44
|
|
|
public function _before(AcceptanceTester $I) |
|
|
|
|
|
|
45
|
|
|
{ |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function _after(AcceptanceTester $I) |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
// tests |
|
53
|
|
|
public function ensure_that_registration_works(\AcceptanceTester $I) |
|
|
|
|
|
|
54
|
|
|
{ |
|
55
|
|
|
$I->wantTo('ensure that registration works'); |
|
56
|
|
|
$I->amOnPage('srazvs/registration/'); |
|
57
|
|
|
$I->see('Registrace na srazy VS'); |
|
58
|
|
|
$I->see('Třebíč - jaro 2010'); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
View Code Duplication |
public function ensure_that_registrace_works(\AcceptanceTester $I) |
|
|
|
|
|
|
62
|
|
|
{ |
|
63
|
|
|
$I->wantTo('ensure that registrace works'); |
|
64
|
|
|
$I->amOnPage('srazvs/registrace/'); |
|
65
|
|
|
$I->see('Registrace na srazy VS'); |
|
66
|
|
|
$I->see('Třebíč - jaro 2010'); |
|
67
|
|
|
$I->seeInCurrentUrl('/srazvs/registration/'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
View Code Duplication |
public function it_should_fail_registrate_new_visitor(AcceptanceTester $I) |
|
|
|
|
|
|
71
|
|
|
{ |
|
72
|
|
|
$I->amOnPage('/srazvs/registration/'); |
|
73
|
|
|
$I->see('Registrace na srazy VS'); |
|
74
|
|
|
$I->wantTo('Fail registration of new visitor'); |
|
75
|
|
|
$I->click('Uložit', 'form'); |
|
76
|
|
|
$I->seeInCurrentUrl('/srazvs/registration/'); |
|
77
|
|
|
$I->see('Hodnota musí být vyplněna!'); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function it_should_registrate_new_visitor(AcceptanceTester $I) |
|
|
|
|
|
|
81
|
|
|
{ |
|
82
|
|
|
$I->amOnPage('/srazvs/registration/'); |
|
83
|
|
|
$I->see('Registrace na srazy VS'); |
|
84
|
|
|
$I->wantTo('Registrate new visitor'); |
|
85
|
|
|
$this->fillForm($I, $this->successVisitor); |
|
86
|
|
|
$I->click('Uložit', 'form'); |
|
87
|
|
|
$this->successRegistrationUri = $I->grabFromCurrentUrl(); |
|
88
|
|
|
$I->seeCurrentUrlMatches($this->succeededRegistrationUrl); |
|
89
|
|
|
$I->see('úspěšně vytvořen'); |
|
90
|
|
|
$I->see('Registrace na srazy K + K'); |
|
91
|
|
|
foreach ($this->successVisitor['fields'] as $field => $value) { |
|
92
|
|
|
$I->see($value); |
|
93
|
|
|
} |
|
94
|
|
|
$I->see($this->successVisitor['options']['province']); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function visitor_should_edit_its_registration(AcceptanceTester $I) |
|
|
|
|
|
|
98
|
|
|
{ |
|
99
|
|
|
$I->amOnPage($this->successRegistrationUri); |
|
100
|
|
|
$I->wantTo('Edit registration by visitor'); |
|
101
|
|
|
$I->click('Upravit', '#button-line'); |
|
102
|
|
|
$this->seeInForm($I, $this->successVisitor); |
|
103
|
|
|
$I->fillField('name', 'Metro'); |
|
104
|
|
|
$I->click('Uložit', '#registration'); |
|
105
|
|
|
$this->successRegistrationUri = $I->grabFromCurrentUrl(); |
|
106
|
|
|
$I->seeCurrentUrlMatches($this->succeededRegistrationUrl); |
|
107
|
|
|
$I->see('úspěšně upravena'); |
|
108
|
|
|
$I->see('Registrace na srazy K + K'); |
|
109
|
|
|
$I->see('Metro'); |
|
110
|
|
|
$I->dontSee('robo', '#name'); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function visitor_should_change_its_programs(AcceptanceTester $I) |
|
|
|
|
|
|
114
|
|
|
{ |
|
115
|
|
|
$this->successRegistrationUri = str_replace('update', 'check', $this->successRegistrationUri); |
|
116
|
|
|
$I->amOnPage($this->successRegistrationUri); |
|
117
|
|
|
$I->wantTo('Change programs by visitor'); |
|
118
|
|
|
$I->click('Upravit', '#button-line'); |
|
119
|
|
|
$I->seeOptionIsSelected('blck_6', '0'); |
|
120
|
|
|
$I->dontSeeOptionIsSelected('blck_6', '1'); |
|
121
|
|
|
$I->selectOption('blck_6', '1'); |
|
122
|
|
|
$I->click('Uložit', '#registration'); |
|
123
|
|
|
$I->seeCurrentUrlMatches($this->succeededRegistrationUrl); |
|
124
|
|
|
$I->see('úspěšně upravena'); |
|
125
|
|
|
$I->see('Registrace na srazy K + K'); |
|
126
|
|
|
$I->see('- Hry a hříčky'); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
} |
|
130
|
|
|
|
This check marks private properties in classes that are never used. Those properties can be removed.