|
@@ 76-85 (lines=10) @@
|
| 73 |
|
$this->assertContainsOnlyInstancesOf('stdClass', $this->model->all()); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
public function testUpdateChangesTheValueOfObjectInDatabase() |
| 77 |
|
{ |
| 78 |
|
$this->model->setProperties(['id' => 2, 'name' => 'pyjac', 'age' => '419']); |
| 79 |
|
$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement); |
| 80 |
|
$this->sqlStatement->shouldReceive('execute'); |
| 81 |
|
$this->sqlStatement->shouldReceive('fetchAll')->once()->andReturn([new stdClass,new stdClass]); |
| 82 |
|
$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1); |
| 83 |
|
|
| 84 |
|
$this->assertEquals(1, $this->model->update()); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
public function testCreateObjectInDatabase() |
| 88 |
|
{ |
|
@@ 87-96 (lines=10) @@
|
| 84 |
|
$this->assertEquals(1, $this->model->update()); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
public function testCreateObjectInDatabase() |
| 88 |
|
{ |
| 89 |
|
$this->model->setProperties(['id' => 2, 'name' => 'pyjac', 'age' => '419']); |
| 90 |
|
$this->databaseConnection->shouldReceive('prepare')->once()->andReturn($this->sqlStatement); |
| 91 |
|
$this->sqlStatement->shouldReceive('execute'); |
| 92 |
|
$this->sqlStatement->shouldReceive('fetchAll')->once()->andReturn([new stdClass,new stdClass]); |
| 93 |
|
$this->sqlStatement->shouldReceive('rowCount')->once()->andReturn(1); |
| 94 |
|
|
| 95 |
|
$this->assertEquals(1, $this->model->create()); |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
|
| 99 |
|
public function testDeleteReturnsTrueWhenModelIsSuccessfullyRemovedFromDatabase() |