From 19608db66da202d16c860ff4e533e1dd1ec6dfb6 Mon Sep 17 00:00:00 2001
From: Dave MacFarlane <driusan@gmail.com>
Date: Wed, 16 Dec 2020 09:46:03 -0500
Subject: [PATCH] Use mocks for failing tests

---
 test/unittests/NDB_Factory_Test.php | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/unittests/NDB_Factory_Test.php b/test/unittests/NDB_Factory_Test.php
index 2ef5b205dd3..56b648c27e2 100644
--- a/test/unittests/NDB_Factory_Test.php
+++ b/test/unittests/NDB_Factory_Test.php
@@ -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),
@@ -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),