1
|
|
|
<?php |
2
|
|
|
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace EasyDictionary; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
class ManagerTest extends TestCase |
|
|
|
|
10
|
|
|
{ |
11
|
|
|
public function testClassExistence() |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
$this->assertTrue(class_exists('\EasyDictionary\Manager')); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function testCheckPublicAttributes() |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
$this->assertClassHasAttribute('defaultDictionary', \EasyDictionary\Manager::class); |
19
|
|
|
$this->assertClassHasAttribute('defaultDataProvider', \EasyDictionary\Manager::class); |
20
|
|
|
$this->assertClassHasAttribute('config', \EasyDictionary\Manager::class); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function testDefaultValues() |
|
|
|
|
24
|
|
|
{ |
25
|
|
|
$manager = new \EasyDictionary\Manager(); |
26
|
|
|
$this->assertEquals('EasyDictionary\Dictionary\Simple', $manager->defaultDictionary); |
27
|
|
|
$this->assertEquals('EasyDictionary\DataProvider\Simple', $manager->defaultDataProvider); |
28
|
|
|
$this->assertEquals([], $manager->config); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function testSettersAndGetters() |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
$manager = new \EasyDictionary\Manager(); |
34
|
|
|
$manager->setDefaultDataProvider('defaultDataProvider'); |
35
|
|
|
$this->assertEquals('defaultDataProvider', $manager->getDefaultDataProvider()); |
36
|
|
|
|
37
|
|
|
$manager->setDefaultDictionary('defaultDictionary'); |
38
|
|
|
$this->assertEquals('defaultDictionary', $manager->getDefaultDictionary()); |
39
|
|
|
|
40
|
|
|
$manager->setConfig([1, 2, 3]); |
41
|
|
|
$this->assertEquals([1, 2, 3], $manager->getConfig()); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|