Completed
Push — master ( 37b207...7906ee )
by Helmut
37:09
created

ButtonTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

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 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_can_be_rendered() 0 6 1
A it_does_not_touch_the_model() 0 10 1
1
<?php
2
3
namespace Helmut\Forms\Testing;
4
5
class ButtonTest extends FormTestCase {
6
7
	/** @test */
8
	public function it_can_be_rendered()
9
	{
10
		$form = $this->form();
11
		$form->button('register');
0 ignored issues
show
Bug introduced by
The method button() does not exist on Helmut\Forms\Testing\Stubs\Form. Did you maybe mean addButton()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
12
		$this->assertContains('<button name="register"', $form->render());
13
	}
14
15
	/** @test */
16
	public function it_does_not_touch_the_model()
17
	{
18
		$model = $this->model(['register'=>'123']);
19
20
		$form = $this->form();
21
		$form->button('register');
0 ignored issues
show
Bug introduced by
The method button() does not exist on Helmut\Forms\Testing\Stubs\Form. Did you maybe mean addButton()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
22
		$form->fill($model);
23
24
		$form->assertEquals($model->register, '123');
0 ignored issues
show
Documentation Bug introduced by
The method assertEquals does not exist on object<Helmut\Forms\Testing\Stubs\Form>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
25
	}		
26
27
}
28