1 | <?php |
||
2 | /** |
||
3 | * Created by Marcin. |
||
4 | * Date: 03.03.2019 |
||
5 | * Time: 16:52 |
||
6 | */ |
||
7 | |||
8 | namespace Tests\Mrcnpdlk\Api\Unoconv; |
||
9 | |||
10 | use Mrcnpdlk\Api\Unoconv\Config; |
||
11 | use Mrcnpdlk\Api\Unoconv\Enum\DocType; |
||
12 | use Mrcnpdlk\Api\Unoconv\Enum\FormatType; |
||
13 | use Mrcnpdlk\Lib\ConfigurationException; |
||
14 | use PHPUnit\Framework\TestCase; |
||
15 | |||
16 | class ConfigTest extends TestCase |
||
17 | { |
||
18 | /** |
||
19 | * @throws \Mrcnpdlk\Lib\ConfigurationException |
||
20 | */ |
||
21 | public function testConstruct_1(): void |
||
22 | { |
||
23 | $oConfig = new Config(); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
24 | $this->assertTrue(true); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @throws \Mrcnpdlk\Lib\ConfigurationException |
||
29 | */ |
||
30 | public function testConstruct_2(): void |
||
31 | { |
||
32 | $oConfig = new Config([]); |
||
0 ignored issues
–
show
|
|||
33 | $this->assertTrue(true); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @throws \Mrcnpdlk\Lib\ConfigurationException |
||
38 | */ |
||
39 | public function testConstruct_3(): void |
||
40 | { |
||
41 | $oConfig = new Config([ |
||
42 | 'binary' => 'some_binary_file', |
||
43 | 'host' => '127.0.0.1', |
||
44 | 'port' => 2345, |
||
45 | 'docType' => DocType::GRAPHICS(), |
||
46 | 'format' => FormatType::PDF(), |
||
47 | 'timeout' => 10, |
||
48 | ]); |
||
49 | $this->assertSame(DocType::GRAPHICS, $oConfig->getDocType()->getValue()); |
||
50 | $this->assertSame(FormatType::PDF, $oConfig->getFormat()->getValue()); |
||
51 | $this->assertSame(10, $oConfig->getTimeout()); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @throws \Mrcnpdlk\Lib\ConfigurationException |
||
56 | */ |
||
57 | public function testConstruct_invalid(): void |
||
58 | { |
||
59 | $this->expectException(ConfigurationException::class); |
||
60 | $oConfig = new Config([ |
||
0 ignored issues
–
show
|
|||
61 | 'foo_bar' => null, |
||
62 | ]); |
||
63 | } |
||
64 | } |
||
65 |