Code Duplication    Length = 8-9 lines in 4 locations

test/ModelTest.php 4 locations

@@ 58-66 (lines=9) @@
55
    /**
56
     * @expectedException Pyjac\ORM\Exception\ModelNotFoundException
57
     */
58
    public function testGetThrowsModelNotFoundExceptionWhenIdNotFoundInDatabase()
59
    {
60
    	$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
61
    	$this->sqlStatement->shouldReceive('setFetchMode');
62
    	$this->sqlStatement->shouldReceive('execute');
63
    	$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
64
    	
65
    	$this->assertInstanceOf('stdClass', $this->model->get(1));
66
    }
67
68
    public function testAllReturnsAnArrayOfObjectsWhenValuesAreInDatabase()
69
    {
@@ 96-103 (lines=8) @@
93
    	$this->assertEquals(1, $this->model->create());
94
    }
95
96
    public function testSaveShouldCreateNewModelInDatabaseWhenIdNotPresent()
97
    {
98
    	$this->model->setProperties(['name' => 'pyjac', 'age' => '419']);
99
    	$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
100
    	$this->sqlStatement->shouldReceive('execute');
101
    	$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1);
102
    	$this->assertEquals(1, $this->model->save());
103
    }
104
105
    public function testSaveShouldUpdateModelInDatabaseIfIdIsPresent()
106
    {
@@ 122-129 (lines=8) @@
119
    	$this->assertEquals($values, $this->model->getProperties());
120
    }
121
122
    public function testDeleteReturnsTrueWhenModelIsSuccessfullyRemovedFromDatabase()
123
    {
124
    	$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
125
    	$this->sqlStatement->shouldReceive('execute');
126
    	$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1);
127
    	
128
    	$this->assertEquals(true, $this->model->delete(1));
129
    }
130
131
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
132
    {
@@ 131-138 (lines=8) @@
128
    	$this->assertEquals(true, $this->model->delete(1));
129
    }
130
131
    public function testDeleteReturnsFalseWhenModelWasNotDeletedFromDatabase()
132
    {
133
    	$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement);
134
    	$this->sqlStatement->shouldReceive('execute');
135
    	$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(0);
136
    	
137
    	$this->assertEquals(false, $this->model->delete(1));
138
    }
139
140
    public function testMagicMethodsReturnCorrectResult() {
141
	    /*$this->model->setReturnValue('__get', 'Pyjac', array('name'));