fixes for #1467 #1479 #1462 #1489
[openemr.git] / tests / unit / BaseHarness.class.php
blobbedf49d9880c069e49e85966455f17501c3794bb
1 <?php
2 /* Copyright © 2010 by Andrew Moore */
3 /* Licensing information appears at the end of this file. */
5 error_reporting(E_ALL);
6 require_once 'PHPUnit/Framework.php';
7 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../library');
8 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../../library/classes');
9 require_once 'Installer.class.php';
11 class BaseHarness extends PHPUnit_Framework_TestCase
13 public static function get_installer()
15 $fixture_cgi = array( 'login' => 'test_login',
16 'iuser' => 'test_iuser',
17 'iuname' => 'test_iuname',
18 'igroup' => 'test_igroup',
19 'pass' => 'test_pass',
20 'server' => 'localhost',
21 'loginhost' => 'localhost',
22 'port' => '3306',
23 'root' => 'root',
24 'rootpass' => getenv('EMR_ROOT_DATABASE_PASSWORD'),
25 'dbname' => 'openemr_test_suite',
26 'collate' => 'utf8_general_ci',
27 'site' => 'default',
29 return new Installer( $fixture_cgi );
33 public static function setUpBeforeClass()
35 // session_start();
36 $_SESSION['authUser'] = 'tester';
37 $_SESSION['authGroup'] = 'testgroup';
39 $GLOBALS = array( 'enable_auditlog' => '0',
41 $_SERVER['REQUEST_URI'] = '';
42 $_SERVER['SERVER_NAME'] = '';
43 $_SERVER['HTTP_HOST'] = 'default';
44 $ignoreAuth = 1;
46 $installer = self::get_installer();
47 if ( ! $installer->quick_install() ) {
48 echo "quick_install failed:\n";
49 echo $installer->error_message;
50 exit;
52 require_once 'globals.inc.php';
53 require_once 'interface/globals.php';
54 require_once "$srcdir/options.inc.php";
56 $_SESSION['authUser'] = 'tester';
57 $_SESSION['authGroup'] = 'testgroup';
60 public static function tearDownAfterClass()
62 $installer = self::get_installer();
63 $installer->drop_database();
68 This file is free software: you can redistribute it and/or modify it under the
69 terms of the GNU General Public License as publish by the Free Software
70 Foundation.
72 This file is distributed in the hope that it will be useful, but WITHOUT ANY
73 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
74 PARTICULAR PURPOSE. See the GNU Gneral Public License for more details.
76 You should have received a copy of the GNU General Public Licence along with
77 this file. If not see <http://www.gnu.org/licenses/>.