AnnotationCest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 78
Duplicated Lines 51.28 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 40
loc 78
rs 10
c 0
b 0
f 0
wmc 10
lcom 1
cbo 2

6 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 3 1
A _after() 0 3 1
A ensure_that_block_annotation_works() 12 12 2
A ensure_that_program_annotation_works() 12 12 2
A block_annotation_should_be_accessible_by_public() 8 8 2
A program_annotation_should_be_accessible_by_public() 8 8 2

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
0 ignored issues
show
Security Bug introduced by
It is not recommended to output anything before PHP's opening tag in non-template files.
Loading history...
2
<?php
3
4
class AnnotationCest extends CestCase
5
{
6
7
	private $annotationBlock = [
8
		'fields' => [
9
			'name'			=> '20:00 - Zahájení srazu',
10
			'description'	=> '',
11
			'tutor'			=> 'Tomáš Litera',
12
			'email'			=> '[email protected]',
13
			'capacity'		=> '0',
14
		],
15
	];
16
17
	private $annotationProgram = [
18
		'fields' => [
19
			'name'			=> 'Hry a hříčky',
20
			'description'	=> 'sflvbhflevblf',
21
			'material'		=> '',
22
			'tutor'			=> '',
23
			'email'			=> '[email protected],[email protected]',
24
			'capacity'		=> '200',
25
		],
26
	];
27
28
	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...
29
	{
30
	}
31
32
	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...
33
	{
34
	}
35
36
	// tests
37 View Code Duplication
	public function ensure_that_block_annotation_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...
38
	{
39
		$I->wantTo('Ensure that blocks annotation works');
40
		$I = $this->logIn($I);
41
		$I->amOnPage('/srazvs/block/edit/2?page=block');
42
		$I->see('úprava bloku');
43
		$I->click('Náhled anotace', '#content');
44
		$I->seeInCurrentUrl('/srazvs/block/annotation/382ff1c792c7980aa0b1950259a518e8');
45
		foreach ($this->annotationBlock['fields'] as $field => $value) {
46
			$I->seeInField($field, $value);
47
		}
48
	}
49
50 View Code Duplication
	public function ensure_that_program_annotation_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...
51
	{
52
		$I->wantTo('Ensure that programs annotation works');
53
		$I = $this->logIn($I);
54
		$I->amOnPage('/srazvs/program/edit/1?page=program');
55
		$I->see('úprava programu');
56
		$I->click('Náhled anotace', '#content');
57
		$I->seeInCurrentUrl('/srazvs/program/annotation/524888c93f896f388d563f68682cf41c');
58
		foreach ($this->annotationProgram['fields'] as $field => $value) {
59
			$I->seeInField($field, $value);
60
		}
61
	}
62
63 View Code Duplication
	public function block_annotation_should_be_accessible_by_public(\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...
64
	{
65
		$I->wantTo('Ensure that blocks annotation is accesible by public');
66
		$I->amOnPage('/srazvs/block/annotation/382ff1c792c7980aa0b1950259a518e8');
67
		foreach ($this->annotationBlock['fields'] as $field => $value) {
68
			$I->seeInField($field, $value);
69
		}
70
	}
71
72 View Code Duplication
	public function program_annotation_should_be_accessible_by_public(\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...
73
	{
74
		$I->wantTo('Ensure that programs annotation is accesible by public');
75
		$I->amOnPage('/srazvs/program/annotation/524888c93f896f388d563f68682cf41c');
76
		foreach ($this->annotationProgram['fields'] as $field => $value) {
77
			$I->seeInField($field, $value);
78
		}
79
	}
80
81
}
82