Completed
Push — dev ( 1404ff...b5377b )
by
unknown
10s
created

AdminControllerTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B testIndexAction() 0 25 1
1
<?php
2
3
namespace Tests\AppBundle\Controller;
4
5
use AppBundle\Entity\Admin;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
8
class AdminControllerTest extends WebTestCase
9
{
10
    public function testIndexAction()
11
    {
12
        exec('./bin/console d:d:c --env=test');
13
        exec('./bin/console d:s:c --env=test');
14
        exec('./bin/console h:f:l -n --env=test');
15
        $client = static::createClient();
16
        $em =  $client->getContainer()->get('doctrine');
17
18
        $crawler = $client->request('GET', '/login');
19
        $form = $crawler->selectButton('Login')->form();
20
        $client->submit($form, ['_username' => '[email protected]', '_password' => 'admin']);
21
22
        $crawler = $client->request('GET', '/admin/');
23
24
        $form = $crawler->selectButton('Save')->form();
25
        $client->submit($form, [
26
            'admin[userName]' => 'test1',
27
            'admin[email]' => '[email protected]',
28
        ]);
29
        $admin = $em->getRepository(Admin::class)->findOneBy(['userName' => 'test1']);
30
31
        $this->assertInstanceOf(Admin::class, $admin);
32
33
        exec('./bin/console d:d:d --force --env=test');
34
    }
35
}
36