16 require_once(dirname(__FILE__) .
'/../common-pkg.php');
17 require_once(dirname(__FILE__) .
'/../common-db.php');
31 protected function setUp() :
void
34 $this->testDb =
new TestPgDb(
"fosslibtest");
35 $tables = array(
'mimetype');
36 $this->testDb->createPlainTables($tables);
37 $sequences = array(
'mimetype_mimetype_pk_seq');
38 $this->testDb->createSequences($sequences);
39 $this->testDb->createConstraints([
'dirmodemask',
'mimetype_pk']);
40 $this->testDb->alterTables($tables);
41 $this->
dbManager = $this->testDb->getDbManager();
50 #prepare database testdata
51 $mimeType =
"application/x-rpm";
53 $sql =
"DELETE FROM mimetype where mimetype_name in ('$mimeType');";
54 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"delete.mimetype");
56 $sql =
"INSERT INTO mimetype(mimetype_pk, mimetype_name) VALUES(10000, '$mimeType');";
57 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"insert.mimetype");
59 #begin test GetPkgMimetypes()
60 $sql =
"select * from mimetype where
61 mimetype_name='application/x-rpm'";
62 $row = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"select.mimetype");
63 $expected = $row[
'mimetype_pk'];
66 $this->assertContains($expected, $result);
69 $sql =
"DELETE FROM mimetype where mimetype_name in ('$mimeType');";
70 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"delete.mimetype");
78 if (!is_callable(
'pg_connect')) {
81 $this->testDb->fullDestruct();
test_GetPkgMimetypes()
test for GetPkgMimetypes()
GetPkgMimetypes()
Get package mimetype.
fo_dbManager * dbManager
fo_dbManager object