13 public function testIfTestDbIsCreated()
16 $this->markTestSkipped();
17 $dbName =
'fosstestone';
18 exec($cmd=
"dropdb -Ufossy -hlocalhost $dbName", $cmdOut, $cmdRtn);
23 exec($cmd=
"psql -Ufossy -hlocalhost -l | grep -q $dbName", $cmdOut, $cmdRtn);
24 assertThat($cmdRtn,is(0));
27 public function testGetDbManager()
30 $this->assertInstanceOf(
'Fossology\Lib\Db\DbManager', $testDb->getDbManager());
33 public function testCreatePlainTables()
36 $testDb->createPlainTables(array(
'tag'));
37 $dbManager = $testDb->getDbManager();
39 $dbManager->queryOnce(
"insert into tag (tag_pk,tag,tag_desc) values (1,'hello','world')");
40 $tag1 = $dbManager->getSingleRow(
'select * from tag where tag_pk=1');
41 assertThat($tag1,hasKey(
'tag_desc'));
42 assertThat($tag1[
'tag_desc'],is(
'world'));
45 public function testInsertData()
48 $testDb->createPlainTables(array(
'perm_upload'));
49 $testDb->insertData(array(
'perm_upload'));
50 $tag1 = $testDb->getDbManager()->getSingleRow(
'select perm from perm_upload where perm_upload_pk=1');
51 assertThat($tag1,hasKey(
'perm'));
52 assertThat($tag1[
'perm'],is(10));