Skip to content

Commit

Permalink
fix database text
Browse files Browse the repository at this point in the history
  • Loading branch information
kongtiaowang committed Dec 16, 2020
1 parent 265ed8c commit 937eab9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 1 addition & 5 deletions test/unittests/Database_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ function _getAllMethodsExcept($methods)
*/
function testSetFakeData()
{
$client = new NDB_Client();
$client->makeCommandLine();
$client->initialize();

$this->DB->setFakeTableData(
"Config",
[
Expand All @@ -152,7 +148,7 @@ function testSetFakeData()
);

$allCandidates = $this->DB->pselect("SELECT * FROM Config", []);

$this->DB->run("DROP TEMPORARY TABLE Config");
$this->assertEquals(
$allCandidates,
[
Expand Down
12 changes: 12 additions & 0 deletions test/unittests/NDB_Factory_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ function testProject()
function testCandidate()
{
$candID = new CandID("300001");
$mockdb = $this->getMockBuilder("\Database")->getMock();
$this->_factory->setDatabase($mockdb);
$mockdb->expects($this->any())
->method('pselectRow')
->willReturn(['DCCID'=>'300001']);
$this->assertEquals(
Candidate::singleton($candID),
$this->_factory->candidate($candID)
Expand All @@ -251,6 +256,13 @@ function testCandidate()
function testTimepoint()
{
$sessionID = new \SessionID("1");
$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']);
$this->assertEquals(
\TimePoint::singleton($sessionID),
$this->_factory->timepoint($sessionID)
Expand Down

0 comments on commit 937eab9

Please sign in to comment.