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

TextTest::testContextNonOverridingMerge()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
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