Completed
Push — master ( 4b4c57...035a27 )
by Rafael
03:03
created

ReflectionReaderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsReadable() 0 9 1
A testGetValue() 0 10 1
1
<?php
2
3
/**
4
 * LICENSE: This file is subject to the terms and conditions defined in
5
 * file 'LICENSE', which is part of this source code package.
6
 *
7
 * @copyright 2016 Copyright(c) - All rights reserved.
8
 */
9
10
namespace Rafrsr\LibArray2Object\Tests\Reader;
11
12
use Rafrsr\LibArray2Object\Reader\ReflectionReader;
13
use Rafrsr\LibArray2Object\Tests\Fixtures\Team;
14
15
class ReflectionReaderTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testIsReadable()
18
    {
19
        $reader = new ReflectionReader();
20
        static::assertTrue($reader->isReadable(new Team(), 'name'));
21
        static::assertFalse($reader->isReadable(new Team(), 'none'));
22
23
        $reader = new ReflectionReader(true);
24
        static::assertFalse($reader->isReadable(new Team(), 'name'));
25
    }
26
27
    public function testGetValue()
28
    {
29
        $reader = new ReflectionReader();
30
        $team = new Team();
31
        $team->setName('New Name');
32
        static::assertEquals('New Name', $reader->getValue($team, 'name'));
33
34
        $reader = new ReflectionReader(true);
35
        static::assertNull($reader->getValue($team, 'name'));
36
    }
37
}
38