Completed
Pull Request — master (#30)
by
unknown
04:28
created

DefaultControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testUpdatePassword() 0 14 1
A testIndex() 0 14 1
1
<?php
2
3
namespace Tests\AppBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
7
class DefaultControllerTest extends WebTestCase
8
{
9
    public function testIndex()
10
    {
11
        exec('./bin/console d:d:c --env=test');
12
        exec('./bin/console d:s:c --env=test');
13
        exec('./bin/console h:f:l -n --env=test');
14
15
        $client = static::createClient();
16
17
        $crawler = $client->request('GET', '/login');
18
19
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
20
21
        $this->assertCount(3, $crawler->filter('input'));
22
    }
23
24
    public function testUpdatePassword()
25
    {
26
        $client = static::createClient();
27
        $crawler = $client->request('GET', '/password_update/2');
28
        $this->assertEquals('200', $client->getResponse()->getStatusCode());
29
30
        $form = $crawler->selectButton('Submit')->form();
31
        $form['reset_password[plainPassword][first]'] = 'new';
32
        $form['reset_password[plainPassword][second]'] = 'new';
33
        $client->submit($form);
0 ignored issues
show
Documentation introduced by
$form is of type array<string,string,{"re...rd][second]":"string"}>, but the function expects a object<Symfony\Component\DomCrawler\Form>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
34
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
35
36
        exec('./bin/console d:d:d --force --env=test');
37
    }
38
}
39