|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This is the PHPUnit test for SMF's installation process. |
|
5
|
|
|
* |
|
6
|
|
|
* Simple Machines Forum (SMF) |
|
7
|
|
|
* |
|
8
|
|
|
* @package SMF |
|
9
|
|
|
* @author Simple Machines https://www.simplemachines.org |
|
10
|
|
|
* @copyright 2020 Simple Machines and individual contributors |
|
11
|
|
|
* @license https://www.simplemachines.org/about/smf/license.php BSD |
|
12
|
|
|
* |
|
13
|
|
|
* @version 2.1 RC2 |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
define('SMFPHPUNIT',TRUE); |
|
17
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
|
|
18
|
|
|
require_once('./install.php'); |
|
19
|
|
|
|
|
20
|
|
|
final class InstallTest extends TestCase |
|
21
|
|
|
{ |
|
22
|
|
|
public function testWrite() { |
|
23
|
|
|
load_lang_file(); |
|
24
|
|
|
$var = CheckFilesWritable(); |
|
25
|
|
|
$this->assertEquals(true,$var); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testDBSettings() { |
|
29
|
|
|
$_POST['db_type'] = 'postgresql'; |
|
30
|
|
|
$_POST['db_prefix'] = 'smf_'; |
|
31
|
|
|
$_POST['db_name'] = 'postgres'; |
|
32
|
|
|
$_POST['db_user'] = 'postgres'; |
|
33
|
|
|
$_POST['db_passwd'] = ''; |
|
34
|
|
|
$_POST['db_server'] = 'localhost'; |
|
35
|
|
|
$_POST['db_port'] = '5432'; |
|
36
|
|
|
|
|
37
|
|
|
// updateSettingsFile got different way to detect setting dir... |
|
38
|
|
|
$GLOBALS['boarddir'] = getcwd(); |
|
39
|
|
|
|
|
40
|
|
|
load_lang_file(); |
|
41
|
|
|
$var = DatabaseSettings(); |
|
42
|
|
|
$this->assertEquals(true,$var); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testForumSettings() { |
|
46
|
|
|
$_SERVER['SERVER_NAME'] = 'localhost'; |
|
47
|
|
|
$_POST['boardurl'] = 'http://localhost'; |
|
48
|
|
|
$_POST['mbname'] = 'My PHPUnit Community'; |
|
49
|
|
|
load_lang_file(); |
|
50
|
|
|
$var = ForumSettings(); |
|
51
|
|
|
$this->assertEquals(true,$var); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function testDatabasePopulation() { |
|
55
|
|
|
load_lang_file(); |
|
56
|
|
|
$var = DatabasePopulation(); |
|
57
|
|
|
$this->assertEquals(true,$var); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testAdminAccount() { |
|
61
|
|
|
$_POST['username'] = 'Admin'; |
|
62
|
|
|
$_POST['email'] = '[email protected]'; |
|
63
|
|
|
$_POST['password1'] = 'admin'; |
|
64
|
|
|
$_POST['contbutt'] = '1234'; |
|
65
|
|
|
|
|
66
|
|
|
$_POST['password2'] = $_POST['password1']; |
|
67
|
|
|
$_POST['server_email'] = $_POST['email']; |
|
68
|
|
|
load_lang_file(); |
|
69
|
|
|
$var = AdminAccount(); |
|
70
|
|
|
$this->assertEquals(true,$var); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
?> |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths