convert to new security model for chart_location_activity
[openemr.git] / Tests / BaseHarness.class.php
blob3f10edd88cfad9ca0a4070118cb1dca19c751127
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 'translation.inc.php';
53 require_once 'globals.inc.php';
54 require_once 'interface/globals.php';
55 require_once "$srcdir/sql.inc";
56 require_once "$srcdir/options.inc.php";
58 $_SESSION['authUser'] = 'tester';
59 $_SESSION['authGroup'] = 'testgroup';
62 public static function tearDownAfterClass()
64 $installer = self::get_installer();
65 $installer->drop_database();
70 This file is free software: you can redistribute it and/or modify it under the
71 terms of the GNU General Public License as publish by the Free Software
72 Foundation.
74 This file is distributed in the hope that it will be useful, but WITHOUT ANY
75 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
76 PARTICULAR PURPOSE. See the GNU Gneral Public License for more details.
78 You should have received a copy of the GNU General Public Licence along with
79 this file. If not see <http://www.gnu.org/licenses/>.