CestCase   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 49
Duplicated Lines 57.14 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 28
loc 49
rs 10
c 0
b 0
f 0
wmc 11
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B fillForm() 14 14 5
B seeInForm() 14 14 5
A logIn() 0 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
// Here you can initialize variables that will be available to your tests
3
4
/**
5
* Default cest case
6
*/
7
class CestCase
8
{
9
10 View Code Duplication
	protected function fillForm(\AcceptanceTester $I, array $formData)
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...
11
	{
12
		if(array_key_exists('fields', $formData)) {
13
			foreach($formData['fields'] as $field => $value) {
14
				$I->fillField($field, $value);
15
			}
16
		}
17
18
		if(array_key_exists('options', $formData)) {
19
			foreach($formData['options'] as $option => $value) {
20
				$I->selectOption($option, $value);
21
			}
22
		}
23
	}
24
25 View Code Duplication
	protected function seeInForm(\AcceptanceTester $I, array $formData)
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...
26
	{
27
		if(array_key_exists('fields', $formData)) {
28
			foreach($formData['fields'] as $field => $value) {
29
				$I->seeInField($field, $value);
30
			}
31
		}
32
33
		if(array_key_exists('options', $formData)) {
34
			foreach($formData['options'] as $option => $value) {
35
				$I->seeOptionIsSelected($option, $value);
36
			}
37
		}
38
	}
39
40
	protected function logIn(\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...
41
	{
42
		$I->amOnPage('admin/');
43
		$I->seeInCurrentUrl('admin/');
44
		$I->fillField('username','tester');
45
		$I->fillField('password','tester');
46
		$I->checkOption('persistent');
47
		$I->click('Přihlásit', '#content');
48
		$I->see('Úvod');
49
		$I->see('tester');
50
		//$this->cookie = $I->grabCookie('vodni.skauting.local');
51
52
		return $I;
53
	}
54
55
}
56