Completed
Push — master ( a423a5...0fdb96 )
by Tobias
03:31
created

TranslationBlockTest::testTrans()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
ccs 13
cts 13
cp 1
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Extractor\Tests\Functional\Visitor\Twig;
13
14
use Translation\Extractor\Visitor\Twig\TranslationBlock;
15
use Translation\Extractor\Visitor\Twig\TwigVisitor;
16
17
/**
18
 * @author Tobias Nyholm <[email protected]>
19
 */
20
final class TranslationBlockTest extends BaseTwigVisitorTest
21
{
22 1
    public function testTrans()
23
    {
24 1
        $collection = $this->getSourceLocations(TwigVisitor::create(), 'Twig/TranslationBlock/trans.html.twig');
25
26 1
        $this->assertCount(3, $collection);
27 1
        $source = $collection->get(0);
28 1
        $this->assertEquals('foobar', $source->getMessage());
29 1
        $this->assertEquals('domain', $source->getContext()['domain']);
30
31 1
        $source = $collection->get(1);
32 1
        $this->assertEquals('no-domain', $source->getMessage());
33 1
        $this->assertEquals('messages', $source->getContext()['domain']);
34
35 1
        $source = $collection->get(2);
36 1
        $this->assertEquals('trans-count', $source->getMessage());
37 1
        $this->assertEquals('messages', $source->getContext()['domain']);
38 1
    }
39
40 2 View Code Duplication
    public function testTranschoice()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42 1
        $collection = $this->getSourceLocations(TwigVisitor::create(), 'Twig/TranslationBlock/transchoice.html.twig');
43
44 1
        $this->assertCount(1, $collection);
45 2
        $source = $collection->first();
46 2
        $this->assertEquals('foobar', $source->getMessage());
47 1
    }
48
}
49