24 public function testIfTestDbIsCreated()
27 $this->markTestSkipped();
28 $dbName =
'fosstestone';
29 exec($cmd=
"dropdb -Ufossy -hlocalhost $dbName", $cmdOut, $cmdRtn);
34 exec($cmd=
"psql -Ufossy -hlocalhost -l | grep -q $dbName", $cmdOut, $cmdRtn);
35 assertThat($cmdRtn,is(0));
38 public function testGetDbManager()
41 $this->assertInstanceOf(
'Fossology\Lib\Db\DbManager', $testDb->getDbManager());
44 public function testCreatePlainTables()
47 $testDb->createPlainTables(array(
'tag'));
48 $dbManager = $testDb->getDbManager();
50 $dbManager->queryOnce(
"insert into tag (tag_pk,tag,tag_desc) values (1,'hello','world')");
51 $tag1 = $dbManager->getSingleRow(
'select * from tag where tag_pk=1');
52 assertThat($tag1,hasKey(
'tag_desc'));
53 assertThat($tag1[
'tag_desc'],is(
'world'));
56 public function testInsertData()
59 $testDb->createPlainTables(array(
'perm_upload'));
60 $testDb->insertData(array(
'perm_upload'));
61 $tag1 = $testDb->getDbManager()->getSingleRow(
'select perm from perm_upload where perm_upload_pk=1');
62 assertThat($tag1,hasKey(
'perm'));
63 assertThat($tag1[
'perm'],is(10));