Skip to content

Commit 3bf3057

Browse files
committed
Use mocks for failing tests
1 parent 265ed8c commit 3bf3057

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/unittests/NDB_Factory_Test.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ function testProject()
234234
*/
235235
function testCandidate()
236236
{
237+
$mockdb = $this->getMockBuilder("\Database")->getMock();
238+
$this->_factory->setDatabase($mockdb);
239+
$mockdb->expects($this->any())
240+
->method('pselectRow')
241+
->willReturn(['DCCID'=>'300001']);
242+
237243
$candID = new CandID("300001");
238244
$this->assertEquals(
239245
Candidate::singleton($candID),
@@ -250,6 +256,14 @@ function testCandidate()
250256
*/
251257
function testTimepoint()
252258
{
259+
$mockdb = $this->getMockBuilder("\Database")->getMock();
260+
$mockconfig = $this->getMockBuilder("\NDB_Config")->getMock();
261+
$this->_factory->setConfig($mockconfig);
262+
$this->_factory->setDatabase($mockdb);
263+
$mockdb->expects($this->any())
264+
->method('pselectRow')
265+
->willReturn(['1']);
266+
253267
$sessionID = new \SessionID("1");
254268
$this->assertEquals(
255269
\TimePoint::singleton($sessionID),

0 commit comments

Comments
 (0)