-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathphpunit.php
62 lines (53 loc) · 1.57 KB
/
phpunit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
error_reporting(E_ALL);
$autoloader = __DIR__ . '/vendor/autoload.php';
if (! file_exists($autoloader)) {
echo "Composer autoloader not found: $autoloader" . PHP_EOL;
echo "Please issue 'composer install' and try again." . PHP_EOL;
exit(1);
}
require $autoloader;
/** @const ROOTPATH CodeIgniter project root directory */
define('ROOTPATH', realpath(__DIR__ . '/../../..') . '/');
chdir(ROOTPATH);
class_alias('Kenjis\CodeIgniter_Cli\Command\Command', 'Command');
class_alias('Kenjis\CodeIgniter_Cli\Command\Seed', 'Seeder');
class_alias('Aura\Cli\Help', 'Help');
// Fix argv
$_SERVER['argv'] = [
ROOTPATH . 'cli',
];
$_SERVER['argc'] = 1;
require ROOTPATH . '/ci_instance.php';
/**
* Fixture for testing
*/
$ci =& get_instance();
// switch database to SQLite for testing
$config = [
'hostname' => 'sqlite:' . __DIR__ . '/tests/data/sqlite-database.db',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'pdo',
'dbprefix' => '',
'pconnect' => true,
'db_debug' => true,
'cache_on' => false,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'stricton' => false,
];
$ci->load->database($config);
// change migration config
$config = [
'migration_enabled' => true,
'migration_type' => 'timestamp',
'migration_table' => 'migrations',
'migration_auto_latest' => false,
'migration_version' => 20150429110003,
'migration_path' => __DIR__ . '/tests/Fake/migrations/',
];
$ci->load->library('migration', $config);