Skip to content

Commit

Permalink
nit testes
Browse files Browse the repository at this point in the history
  • Loading branch information
williamespindola committed Sep 18, 2015
1 parent a1589e4 commit 160b502
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions tests/unit/Storage/ORM/RespectRelationalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,4 @@ public function testSetRepositoryWithValidStringShouldWork()
'The attribute repository is not instance of the string table name: mytable'
);
}

/**
* @depends testSetRepositoryWithValidStringShouldWork
*/
public function testGetRepositoryShouldReturnMockedInstance()
{
$conn = $this->getMock(
'PDO',
['lastInsertId'],
['sqlite::memory:']
);
$conn->exec('CREATE TABLE mytable(id INTEGER PRIMARY KEY)');
$conn->expects($this->any())
->method('lastInsertId')
->will($this->throwException(new \PDOException));

$mapper = $this->getMockBuilder('Respect\Relational\Mapper')
->disableOriginalConstructor()
->getMock();

$collection = $this->getMock('Respect\Data\Collections\Collection');

$mapper->expects($this->any())
->method('__get')
->will($this->returnValue($collection));

$instance = new RespectRelational($mapper);
$instance->setRepository('mytable');

$this->assertInstanceOf(
'Respect\Data\Collections\Collection',
$instance->getRepository(),
'The instance returned by getRepository is not instance of Respect\Data\Collections\Collection'
);
}
}

0 comments on commit 160b502

Please sign in to comment.