Failed Conditions
Push — master ( 01d6ae...9ca6d9 )
by Philippe
534:14 queued 469:10
created

TextTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testContextOverridingMerge() 0 5 1
A testContextNonOverridingMerge() 0 5 1
A testExceptionWhenMergingEmptyContext() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpSpellcheck\Tests;
6
7
use PhpSpellcheck\Exception\InvalidArgumentException;
8
use PhpSpellcheck\Text;
9
use PHPUnit\Framework\TestCase;
10
11
class TextTest extends TestCase
12
{
13
    public const CONTENT_STUB = <<<EOT
14
Tigr, tiger, burning страх.
15
In theforests of the night,
16
What imortal hand or eey
17
CCould frame thy fearful symmetry?
18
EOT;
19
20
    public function testContextOverridingMerge()
21
    {
22
        $text = Text::utf8('test', ['idx' => '1'])->mergeContext(['idx' => 'foo', 'idx2' => '2']);
23
24
        $this->assertEquals(Text::utf8('test', ['idx' => 'foo', 'idx2' => '2']), $text);
25
    }
26
27
    public function testContextNonOverridingMerge()
28
    {
29
        $text = Text::utf8('test', ['idx' => '1'])->mergeContext(['idx' => 'foo', 'idx2' => '2'], false);
30
31
        $this->assertEquals(Text::utf8('test', ['idx' => '1', 'idx2' => '2']), $text);
32
    }
33
34
    public function testExceptionWhenMergingEmptyContext()
35
    {
36
        $this->expectException(InvalidArgumentException::class);
37
        Text::utf8('test', ['idx' => '1'])->mergeContext([]);
38
    }
39
}
40