AbstractFormTest::assertForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 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