| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
PEAR_Info using default configuration
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
$ds = DIRECTORY_SEPARATOR;
|
|
|
6 |
$dir = dirname(__FILE__);
|
|
|
7 |
$sysconfdir = $dir . $ds . 'sysconf_dir';
|
|
|
8 |
$peardir = $dir . $ds . 'pear_dir';
|
|
|
9 |
|
|
|
10 |
putenv("PHP_PEAR_SYSCONF_DIR=" . $sysconfdir);
|
|
|
11 |
chdir($dir);
|
|
|
12 |
|
|
|
13 |
// we get PEAR_Info class only here due to setting of PEAR_CONFIG_SYSCONFDIR
|
|
|
14 |
include_once 'PEAR/Info.php';
|
|
|
15 |
|
|
|
16 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
|
|
17 |
$conf_file = $sysconfdir . $ds . 'pearsys.ini';
|
|
|
18 |
} else {
|
|
|
19 |
$conf_file = $sysconfdir . $ds . 'pear.conf';
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
if (!file_exists($conf_file)) {
|
|
|
23 |
// write once PEAR system-wide config file for simulation
|
|
|
24 |
$config =& PEAR_Config::singleton();
|
|
|
25 |
$config->set('php_dir', $peardir);
|
|
|
26 |
$config->writeConfigFile($conf_file);
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
/**
|
|
|
30 |
* TestCase 1:
|
|
|
31 |
* default class constructor without parameter
|
|
|
32 |
*
|
|
|
33 |
* Must use the pear config files into the default system directory
|
|
|
34 |
* (PEAR_CONFIG_SYSCONFDIR).
|
|
|
35 |
*/
|
|
|
36 |
$testCase = 'testConfigFilesExistInSysConfDir';
|
|
|
37 |
|
|
|
38 |
$pearInfo = new PEAR_Info();
|
|
|
39 |
|
|
|
40 |
$result = (!is_null($pearInfo->reg))
|
|
|
41 |
? 'OK' : 'System PEAR configuration files does not exist';
|
|
|
42 |
|
|
|
43 |
echo $testCase . ' : ' . $result;
|
|
|
44 |
?>
|
|
|
45 |
--CLEAN--
|
|
|
46 |
<?php
|
|
|
47 |
$ds = DIRECTORY_SEPARATOR;
|
|
|
48 |
$dir = dirname(__FILE__);
|
|
|
49 |
$sysconfdir = $dir . $ds . 'sysconf_dir';
|
|
|
50 |
|
|
|
51 |
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
|
|
52 |
$conf_file = $sysconfdir . $ds . 'pearsys.ini';
|
|
|
53 |
} else {
|
|
|
54 |
$conf_file = $sysconfdir . $ds . 'pear.conf';
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
unlink ($conf_file);
|
|
|
58 |
?>
|
|
|
59 |
--EXPECT--
|
|
|
60 |
testConfigFilesExistInSysConfDir : OK
|