FOSSology  4.4.0
Open Source License Compliance by Open Source Software
createTestEnvironment.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2015 Siemens AG
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 $libPhpDir = dirname(dirname(__DIR__)) . "/lib/php/Test";
10 
11 require_once(__DIR__ . "/TestDbFactory.php");
12 require_once($libPhpDir."/TestInstaller.php");
13 
14 $testDbFactory = new TestDbFactory();
15 
16 $sysConfDir = $testDbFactory->setupTestDb("fosstest" . time());
17 
18 $testInstaller = new Fossology\Lib\Test\TestInstaller($sysConfDir);
19 $testInstaller->init();
20 
21 $opts = getopt("d:f", array());
22 if (array_key_exists("d", $opts)) {
23  $srcDir = $opts["d"];
24  foreach (explode(",", $srcDir) as $dir) {
25  if (!empty($dir)) {
26  $testInstaller->install($dir);
27  }
28  }
29 }
30 if (array_key_exists("f", $opts)) {
31  require_once($libPhpDir."/TestPgDb.php");
32  $testPgDb = new Fossology\Lib\Test\TestPgDb($testDbFactory->getDbName($sysConfDir), $sysConfDir);
33  $testPgDb->createSequences(array(), true);
34  $testPgDb->createPlainTables(array(), true);
35  $testPgDb->createInheritedTables(array());
36  $testPgDb->alterTables(array(), true);
37  $testPgDb->createInheritedTables(array('uploadtree_a'));
38 }
39 
40 print $sysConfDir;