Completed
Push — develop ( fbdd82...317691 )
by Mike
09:29
created

ReadModelTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 4
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A itRegistersTheDefinitionAndData() 0 10 1
A itReturnsTheDataWhenUsedAsCallable() 0 9 1
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2010-2016 Mike van Riel<[email protected]>
9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link      http://phpdoc.org
11
 */
12
13
namespace phpDocumentor\DomainModel\ReadModel;
14
15
/**
16
 * @coversDefaultClass phpDocumentor\DomainModel\ReadModel\ReadModel
17
 * @covers ::<private>
18
 */
19
final class ReadModelTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @test
23
     * @covers ::__construct
24
     * @covers ::getName
25
     * @covers ::getData
26
     */
27
    public function itRegistersTheDefinitionAndData()
28
    {
29
        $definition = new Definition('abc', new Type('all'));
30
        $data = 'content';
31
32
        $readModel = new ReadModel($definition, $data);
33
34
        $this->assertSame($definition->getName(), $readModel->getName());
35
        $this->assertSame($data, $readModel->getData());
36
    }
37
38
    /**
39
     * @test
40
     * @covers ::__construct
41
     * @covers ::__invoke
42
     */
43
    public function itReturnsTheDataWhenUsedAsCallable()
44
    {
45
        $definition = new Definition('abc', new Type('all'));
46
        $data = 'content';
47
48
        $readModel = new ReadModel($definition, $data);
49
50
        $this->assertSame($data, $readModel());
51
    }
52
}
53