Completed
Push — master ( ea2537...b94550 )
by Korotkov
09:52 queued 02:19
created

AdapterTest::testAdapt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
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\RegistryAdapter;
14
use Structural\Adapter\AnotherRegistry;
15
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
16
17
/**
18
 * Class AdapterTest
19
 * @package Structural\Adapter\Tests
20
 */
21
class AdapterTest extends PHPUnit_Framework_TestCase
22
{
23
24
    /**
25
     * @var RegistryAdapter
26
     */
27
    protected $adapter;
28
    /**
29
     * @var Registry
30
     */
31
    protected $registry;
32
33
    protected function setUp(): void
34
    {
35
        $this->registry = new Registry();
36
        $this->adapter  = new RegistryAdapter(new AnotherRegistry());
37
    }
38
39
    public function testSecond()
40
    {
41
        $this->registry->setFirst('First');
42
        $this->assertEquals('First', $this->registry->getFirst());
43
        $this->registry->setSecond('3.14');
44
        $this->assertEquals('3.14', $this->registry->getSecond());
45
    }
46
47
    public function testAdapt()
48
    {
49
        $this->adapter->setFirst('First');
50
        $this->assertEquals('First', $this->adapter->getFirst());
51
        $this->adapter->setSecond('3.14');
52
        $this->assertEquals('3.14', $this->adapter->getSecond());
53
    }
54
}
55