Skip to content

Commit

Permalink
Use mocks for failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
driusan committed Dec 16, 2020
1 parent 265ed8c commit 19608db
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unittests/NDB_Factory_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ function testProject()
*/
function testCandidate()
{
$mockdb = $this->getMockBuilder("\Database")->getMock();
$this->_factory->setDatabase($mockdb);
$mockdb->expects($this->any())
->method('pselectRow')
->willReturn(['DCCID'=>'300001']);

$candID = new CandID("300001");
$this->assertEquals(
Candidate::singleton($candID),
Expand All @@ -250,6 +256,14 @@ function testCandidate()
*/
function testTimepoint()
{
$mockdb = $this->getMockBuilder("\Database")->getMock();
$mockconfig = $this->getMockBuilder("\NDB_Config")->getMock();
$this->_factory->setConfig($mockconfig);
$this->_factory->setDatabase($mockdb);
$mockdb->expects($this->any())
->method('pselectRow')
->willReturn(['1']);

$sessionID = new \SessionID("1");
$this->assertEquals(
\TimePoint::singleton($sessionID),
Expand Down

0 comments on commit 19608db

Please sign in to comment.