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

ReflectionReaderTest::testIsReadable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 0
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