Passed
Branch etl-core (c0e492)
by Jean Paul
01:52
created

RowTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 18
c 1
b 0
f 0
dl 0
loc 41
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAttribute() 0 5 1
A testRemoveAttribute() 0 8 1
A testAccessAttributeNotationObject() 0 5 1
A testSetAttribute() 0 8 1
A testAccessAttributeNotationArray() 0 5 1
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