Passed
Push — master ( 2ddebf...84c74c )
by Petr
09:17 queued 01:35
created

LangTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testNone() 0 5 1
A testOwn() 0 7 1
1
<?php
2
3
namespace ChecksTests\TraitsTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_mime\Check\Traits\TLang;
8
use kalanis\kw_mime\Translations;
9
10
11
class LangTest extends CommonTestClass
12
{
13
    public function testOwn(): void
14
    {
15
        $lib = new XLang();
16
        $lib->setMiLang(new XTrLang());
17
        $this->assertInstanceOf(XTrLang::class, $lib->getMiLang());
18
        $this->assertInstanceOf(Translations::class, $lib->getMiLang());
19
        $this->assertEquals('test data', $lib->getMiLang()->miNoStorage());
20
    }
21
22
    public function testNone(): void
23
    {
24
        $lib = new XLang();
25
        $this->assertInstanceOf(Translations::class, $lib->getMiLang());
26
        $this->assertEquals('No storage set!', $lib->getMiLang()->miNoStorage());
27
    }
28
}
29
30
31
class XLang
32
{
33
    use TLang;
34
}
35
36
37
class XTrLang extends Translations
38
{
39
    public function miNoStorage(): string
40
    {
41
        return 'test data';
42
    }
43
}
44