Completed
Push — master ( 9f8480...602ed2 )
by Helmut
04:40
created

SearchTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 35 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 7
loc 20
rs 10

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
3
namespace Helmut\Forms\Testing;
4
5
class SearchTest extends FormTestCase {
6
7
	/** @test */
8
	public function it_can_be_rendered()
9
	{
10
		$form = $this->form();
11
		$form->search('foo');
12
		$this->assertContains('<input name="foo" value=""', $form->render());
13
		$this->assertContains('<button name="foo_button"', $form->render());
14
	}
15
16
	/** @test */
17
	public function it_renders_a_default_value()
18
	{
19
		$form = $this->form();
20
		$form->search('foo')->default('bar');
21
		$this->assertContains('<input name="foo" value="bar"', $form->render());
22
	}
23
24
}
25