Code Duplication    Length = 8-9 lines in 4 locations

test/ModelTest.php 4 locations

@@ 63-71 (lines=9) @@
60
    /**
61
     * @expectedException Pyjac\ORM\Exception\ModelNotFoundException
62
     */
63
    public function testGetThrowsModelNotFoundExceptionWhenIdNotFoundInDatabase()
64
    {
65
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
66
        $this->sqlStatement->shouldReceive('setFetchMode');
67
        $this->sqlStatement->shouldReceive('execute');
68
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
69
70
        $this->assertInstanceOf('stdClass', $this->model->get(1));
71
    }
72
73
    public function testAllReturnsAnArrayOfObjectsWhenValuesAreInDatabase()
74
    {
@@ 127-134 (lines=8) @@
124
        $this->assertEquals($values, $this->model->getProperties());
125
    }
126
127
    public function testDeleteReturnsTrueWhenModelIsSuccessfullyRemovedFromDatabase()
128
    {
129
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
130
        $this->sqlStatement->shouldReceive('execute');
131
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1);
132
133
        $this->assertEquals(true, $this->model->delete(1));
134
    }
135
136
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
137
    {
@@ 136-143 (lines=8) @@
133
        $this->assertEquals(true, $this->model->delete(1));
134
    }
135
136
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
137
    {
138
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
139
        $this->sqlStatement->shouldReceive('execute');
140
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
141
142
        $this->assertEquals(false, $this->model->delete(1));
143
    }
144
145
    public function testMagicMethodsReturnCorrectResult()
146
    {
@@ 91-98 (lines=8) @@
88
        $this->assertEquals(1, $this->model->update());
89
    }
90
91
    public function testCreateObjectInDatabase()
92
    {
93
        $this->model->setProperties(['name' => 'pyjac', 'age' => '419']);
94
        $this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
95
        $this->sqlStatement->shouldReceive('execute');
96
        $this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1);
97
98
        $this->assertEquals(1, $this->model->create());
99
    }
100
101
    public function testSaveShouldCreateNewModelInDatabaseWhenIdNotPresent()