Completed
Push — master ( 09a616...3c6f72 )
by Jordi Sala
01:42 queued 01:34
created

AdminExtractorTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testDebugMissingMessages() 0 12 1
A getKernelClass() 0 4 1
A createCommandTester() 0 7 1
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\Translator\Extractor;
15
16
use Sonata\AdminBundle\Tests\App\AppKernel;
17
use Symfony\Bundle\FrameworkBundle\Console\Application;
18
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
19
use Symfony\Component\Console\Tester\CommandTester;
20
21
final class AdminExtractorTest extends KernelTestCase
22
{
23
    public function testDebugMissingMessages(): void
24
    {
25
        $tester = $this->createCommandTester();
26
        $tester->execute(['locale' => 'en']);
27
28
        $this->assertRegExp('/group_label/', $tester->getDisplay());
29
        $this->assertRegExp('/admin_label/', $tester->getDisplay());
30
        $this->assertRegExp('/Name Show/', $tester->getDisplay());
31
        $this->assertRegExp('/Name List/', $tester->getDisplay());
32
        $this->assertRegExp('/Name Form/', $tester->getDisplay());
33
        $this->assertRegExp('/Date Published/', $tester->getDisplay());
34
    }
35
36
    protected static function getKernelClass(): string
37
    {
38
        return AppKernel::class;
39
    }
40
41
    private function createCommandTester(): CommandTester
42
    {
43
        $kernel = static::createKernel();
44
        $application = new Application($kernel);
45
46
        return new CommandTester($application->find('debug:translation'));
47
    }
48
}
49