Passed
Pull Request — master (#7)
by Jean Paul
01:59
created

RowTest::testAccessAttributeNotationArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php declare( strict_types = 1 );
2
3
namespace Coco\SourceWatcher\Tests\Core;
4
5
use PHPUnit\Framework\TestCase;
6
use Coco\SourceWatcher\Core\Row;
7
8
class RowTest extends TestCase
9
{
10
    public function testGetAttribute () : void
11
    {
12
        $row = new Row( [ "name" => "Jane Doe" ] );
13
        $expectedAttributeValue = "Jane Doe";
14
        $this->assertEquals( $expectedAttributeValue, $row->get( "name" ) );
15
    }
16
17
    public function testSetAttribute () : void
18
    {
19
        $row = new Row( [ "name" => "Jane Doe" ] );
20
        $row->set( "name", "John Doe" );
21
22
        $expectedAttributeValue = "John Doe";
23
24
        $this->assertEquals( $expectedAttributeValue, $row->get( "name" ) );
25
    }
26
27
    public function testRemoveAttribute () : void
28
    {
29
        $row = new Row( [ "name" => "Jane Doe" ] );
30
        $row->remove( "name" );
31
32
        $expectedAttributeValue = null;
33
34
        $this->assertEquals( $expectedAttributeValue, $row->get( "name" ) );
35
    }
36
37
    public function testAccessAttributeNotationArray () : void
38
    {
39
        $row = new Row( [ "name" => "Jane Doe" ] );
40
        $expectedAttributeValue = "Jane Doe";
41
        $this->assertEquals( $expectedAttributeValue, $row["name"] );
42
    }
43
44
    public function testAccessAttributeNotationObject () : void
45
    {
46
        $row = new Row( [ "name" => "Jane Doe" ] );
47
        $expectedAttributeValue = "Jane Doe";
48
        $this->assertEquals( $expectedAttributeValue, $row->name );
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Coco\SourceWatcher\Core\Row. Since you implemented __get, consider adding a @property annotation.
Loading history...
49
    }
50
}
51