Completed
Push — 3.x ( eebc20...445039 )
by Grégoire
04:15
created

CRUDControllerTest::testShow()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\Functional\Controller;
15
16
use Sonata\AdminBundle\Tests\App\AppKernel;
17
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
18
19
final class CRUDControllerTest extends WebTestCase
20
{
21
    public function testList(): void
22
    {
23
        $client = static::createClient();
24
        $crawler = $client->request('GET', '/admin/tests/app/foo/list');
25
26
        $this->assertSame(200, $client->getResponse()->getStatusCode());
27
        $this->assertSame(
28
            1,
29
            $crawler->filter('.sonata-ba-list-field:contains("foo_name")')->count()
30
        );
31
    }
32
33
    public function testCreate(): void
34
    {
35
        $client = static::createClient();
36
        $crawler = $client->request('GET', '/admin/tests/app/foo/create');
37
38
        $this->assertSame(200, $client->getResponse()->getStatusCode());
39
        $this->assertSame(
40
            1,
41
            $crawler->filter('.sonata-ba-collapsed-fields label:contains("Name")')->count()
42
        );
43
    }
44
45
    public function testShow(): void
46
    {
47
        $client = static::createClient();
48
        $crawler = $client->request('GET', '/admin/tests/app/foo/test_id/show');
49
50
        $this->assertSame(200, $client->getResponse()->getStatusCode());
51
        $this->assertSame(
52
            1,
53
            $crawler->filter('td:contains("foo_name")')->count()
54
        );
55
    }
56
57
    public function testEdit(): void
58
    {
59
        $client = static::createClient();
60
        $crawler = $client->request('GET', '/admin/tests/app/foo/test_id/edit');
61
62
        $this->assertSame(200, $client->getResponse()->getStatusCode());
63
        $this->assertSame(
64
            1,
65
            $crawler->filter('.sonata-ba-collapsed-fields label:contains("Name")')->count()
66
        );
67
    }
68
69
    protected static function getKernelClass()
70
    {
71
        return AppKernel::class;
72
    }
73
}
74