AbstractFormTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A submitForm() 0 4 1
A assertForm() 0 7 1
1
<?php
2
3
namespace OpenOrchestra\FunctionalTests\Utils;
4
5
use Symfony\Component\DomCrawler\Crawler;
6
use Symfony\Component\DomCrawler\Form;
7
use Symfony\Component\HttpFoundation\Response;
8
9
/**
10
 * Class AbstractFormTest
11
 */
12
abstract class AbstractFormTest extends AbstractAuthenticatedTest
13
{
14
15
    /**
16
     * @param Form $form
17
     *
18
     * @return Crawler
19
     */
20
    protected function submitForm(Form $form)
21
    {
22
        return $this->client->submit($form);
23
    }
24
25
    /**
26
     * @param Response $response
27
     */
28
    protected function assertForm(Response $response)
29
    {
30
        $this->assertEquals(200, $response->getStatusCode());
31
        $this->assertRegExp('/form/', $response->getContent());
32
        $this->assertNotRegExp('/<html/', $response->getContent());
33
        $this->assertNotRegExp('/_username/', $response->getContent());
34
    }
35
}
36