Completed
Push — master ( e69aa0...885f9f )
by Korotkov
12:18 queued 05:52
created

AdapterTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @license   https://mit-license.org/ MIT
8
 */
9
10
namespace Structural\Adapter\Tests;
11
12
use Structural\Adapter\Registry;
13
use Structural\Adapter\AnotherRegistryAdapter;
14
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
15
16
/**
17
 * Class SingletonsPoolTest
18
 */
19
class AdapterTest extends PHPUnit_Framework_TestCase
20
{
21
22
    protected $registry;
23
    protected $adapter;
24
25
    protected function setUp(): void
26
    {
27
        $this->registry = new Registry();
28
        $this->adapter  = new AnotherRegistryAdapter($this->registry);
29
    }
30
31
    public function testFirstValue()
32
    {
33
        $this->getRegistry()->setFirstValue('FirstValue');
34
        $this->assertEquals('FirstValue', $this->getRegistry()->getFirstValue());
35
    }
36
37
    public function testSecondValue()
38
    {
39
        $this->getRegistry()->setSecondValue('3.14');
40
        $this->assertEquals('3.14', $this->getRegistry()->getSecondValue());
41
    }
42
43
    public function testAdaptFirstValue()
44
    {
45
        $this->getAdapter()->setFirstValue('FirstValue');
46
        $this->assertEquals(0, $this->getAdapter()->getFirstValue());
47
    }
48
49
    public function testAdaptSecondValue()
50
    {
51
        $this->getAdapter()->setSecondValue('3.14');
52
        $this->assertEquals(3, $this->getAdapter()->getSecondValue());
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getRegistry()
59
    {
60
        return $this->registry;
61
    }
62
63
    /**
64
     * @return mixed
65
     */
66
    public function getAdapter()
67
    {
68
        return $this->adapter;
69
    }
70
}
71