Completed
Push — master ( 867208...bb5035 )
by Korotkov
03:36 queued 02:13
created

PrototypeTest::getPrototype()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * @author  : Jagepard <[email protected]>
5
 * @license https://mit-license.org/ MIT
6
 */
7
8
use Creational\Prototype\{Prototype, AbstractPrototype};
9
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
10
11
class PrototypeTest extends PHPUnit_Framework_TestCase
12
{
13
    /**
14
     * @var AbstractPrototype
15
     */
16
    private $prototype;
17
18
    protected function setUp(): void
19
    {
20
        $this->prototype = new Prototype();
21
    }
22
23
    public function testInstances()
24
    {
25
        $clonedFirstPrototype = $this->prototype->getPrototype();
26
        $this->assertFalse($clonedFirstPrototype === $this->prototype);
27
        $this->assertInstanceOf(Prototype::class, $clonedFirstPrototype);
28
    }
29
30
    public function testCountInstances()
31
    {
32
        $this->assertEquals(AbstractPrototype::$count, 1);
33
        $this->prototype->getPrototype();
34
        $this->assertEquals(AbstractPrototype::$count, 2);
35
        $this->prototype->getPrototype();
36
        $this->assertEquals(AbstractPrototype::$count, 3);
37
    }
38
}
39