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();
49 print
"test function GetPkgMimetypes()\n";
51 #prepare database testdata
52 $mimeType =
"application/x-rpm";
54 $sql =
"DELETE FROM mimetype where mimetype_name in ('$mimeType');";
55 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"delete.mimetype");
57 $sql =
"INSERT INTO mimetype(mimetype_pk, mimetype_name) VALUES(10000, '$mimeType');";
58 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"insert.mimetype");
60 #begin test GetPkgMimetypes()
61 $sql =
"select * from mimetype where
62 mimetype_name='application/x-rpm'";
63 $row = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"select.mimetype");
64 $expected = $row[
'mimetype_pk'];
67 $this->assertContains($expected, $result);
70 $sql =
"DELETE FROM mimetype where mimetype_name in ('$mimeType');";
71 $result = $this->
dbManager->getSingleRow($sql, [], __METHOD__ .
"delete.mimetype");
79 if (!is_callable(
'pg_connect')) {
82 $this->testDb->fullDestruct();
test_GetPkgMimetypes()
test for GetPkgMimetypes()
GetPkgMimetypes()
Get package mimetype.
fo_dbManager * dbManager
fo_dbManager object