Code Duplication    Length = 8-9 lines in 3 locations

test/ModelTest.php 3 locations

@@ 60-68 (lines=9) @@
57
        $this->assertInstanceOf('stdClass', $this->model->get(1));
58
    }
59
60
    public function testGetReturnNullWhenIdNotFoundInDatabase()
61
    {
62
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
63
        $this->sqlStatement->shouldReceive('setFetchMode');
64
        $this->sqlStatement->shouldReceive('execute');
65
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
66
67
        $this->assertEquals(null, $this->model->get(1));
68
    }
69
70
    public function testAllReturnsAnArrayOfObjectsWhenValuesAreInDatabase()
71
    {
@@ 124-131 (lines=8) @@
121
        $this->assertEquals($values, $this->model->getProperties());
122
    }
123
124
    public function testDeleteReturnsTrueWhenModelIsSuccessfullyRemovedFromDatabase()
125
    {
126
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
127
        $this->sqlStatement->shouldReceive('execute');
128
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1);
129
130
        $this->assertEquals(true, $this->model->delete(1));
131
    }
132
133
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
134
    {
@@ 133-140 (lines=8) @@
130
        $this->assertEquals(true, $this->model->delete(1));
131
    }
132
133
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
134
    {
135
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
136
        $this->sqlStatement->shouldReceive('execute');
137
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
138
139
        $this->assertEquals(false, $this->model->delete(1));
140
    }
141
142
    public function testMagicMethodsReturnCorrectResult()
143
    {