forked from inetprocess/libsugarcrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplicationTest.php
74 lines (66 loc) · 2.29 KB
/
ApplicationTest.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
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace Inet\SugarCRM\Tests;
use Psr\Log\NullLogger;
use Inet\SugarCRM\Application;
class ApplicationTest extends SugarTestCase
{
public function testSugarPath()
{
$sugarDir = __DIR__ . '/fake_sugar';
$app = new Application(new NullLogger(), $sugarDir);
$this->assertInstanceOf('Inet\SugarCRM\Application', $app);
$this->assertEquals(realpath($sugarDir), $app->getPath());
$this->assertTrue($app->isValid());
$this->assertTrue($app->isInstalled());
$app = new Application(new NullLogger(), __DIR__ . '/invalid_sugar');
$this->assertFalse($app->isInstalled());
}
/**
* @expectedException \Inet\SugarCrm\Exception\SugarException
*/
public function testFailSugarPath()
{
$sugar = new Application(new NullLogger(), __DIR__);
$sugar->getSugarConfig();
}
public function testSugarConfig()
{
$sugar = new Application(new NullLogger(), __DIR__ . '/fake_sugar');
$actual_config = $sugar->getSugarConfig(true);
require(__DIR__ . '/fake_sugar/config.php');
require(__DIR__ . '/fake_sugar/config_override.php');
$sugar_config;
$this->assertEquals($sugar_config, $actual_config);
$conf = $sugar->getSugarConfig();
$this->assertEquals('localhost', $conf['dbconfig']['db_host_name']);
$this->assertEquals('debug', $conf['logger']['level']);
}
/**
* @expectedException \Inet\SugarCrm\Exception\SugarException
*/
public function testInvalidSugarConfig()
{
$sugar = new Application(new NullLogger(), __DIR__ . '/invalid_sugar');
$sugar->getSugarConfig();
}
public function testGetVersion()
{
$sugar = new Application(new NullLogger(), __DIR__ . '/fake_sugar');
$expected = array(
'version' => '7.5.0.1',
'db_version' => '7.5.0.1',
'flavor' => 'PRO',
'build' => '1006',
'build_timestamp' => '2014-12-12 09:59am',
);
$this->assertEquals($expected, $sugar->getVersion());
}
/**
* @expectedException \Inet\SugarCrm\Exception\SugarException
*/
public function testInvalidVersion()
{
$sugar = new Application(new NullLogger(), __DIR__);
$sugar->getVersion();
}
}