RegistrationCest::ensure_that_registration_works()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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]*~';
0 ignored issues
show
Unused Code introduced by
The property $updatedRegistrationUrl is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
43
44
	public function _before(AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
45
	{
46
	}
47
48
	public function _after(AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
49
	{
50
	}
51
52
	// tests
53
	public function ensure_that_registration_works(\AcceptanceTester $I)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $I is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
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