|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class AOR_ConditionTest extends PHPUnit_Framework_TestCase { |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
public function testAOR_Condition(){ |
|
7
|
|
|
|
|
8
|
|
|
//execute the contructor and check for the Object type and attributes |
|
9
|
|
|
$aor_Condition = new AOR_Condition(); |
|
10
|
|
|
$this->assertInstanceOf('AOR_Condition',$aor_Condition); |
|
11
|
|
|
$this->assertInstanceOf('Basic',$aor_Condition); |
|
12
|
|
|
$this->assertInstanceOf('SugarBean',$aor_Condition); |
|
13
|
|
|
|
|
14
|
|
|
$this->assertAttributeEquals('AOR_Conditions', 'module_dir', $aor_Condition); |
|
15
|
|
|
$this->assertAttributeEquals('AOR_Condition', 'object_name', $aor_Condition); |
|
16
|
|
|
$this->assertAttributeEquals('aor_conditions', 'table_name', $aor_Condition); |
|
17
|
|
|
$this->assertAttributeEquals(true, 'new_schema', $aor_Condition); |
|
18
|
|
|
$this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Condition); |
|
19
|
|
|
$this->assertAttributeEquals(true, 'importable', $aor_Condition); |
|
20
|
|
|
$this->assertAttributeEquals(false, 'tracker_visibility', $aor_Condition); |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function testsave_lines(){ |
|
26
|
|
|
|
|
27
|
|
|
error_reporting(E_ERROR | E_PARSE); |
|
28
|
|
|
|
|
29
|
|
|
$aor_Condition = new AOR_Condition(); |
|
30
|
|
|
|
|
31
|
|
|
//preset the required data |
|
32
|
|
|
$post_data = Array(); |
|
33
|
|
|
$post_data['field'][] = 'test field'; |
|
34
|
|
|
$post_data['name'][] = 'test'; |
|
35
|
|
|
$post_data['parameter'][] = '1'; |
|
36
|
|
|
$post_data['module_path'][] = 'test path'; |
|
37
|
|
|
$post_data['operator'][] = 'test'; |
|
38
|
|
|
$post_data['value_type'][] = 'test type'; |
|
39
|
|
|
|
|
40
|
|
|
//execute the method and test if it works and does not throws an exception. |
|
41
|
|
|
try { |
|
42
|
|
|
$aor_Condition->save_lines($post_data, new AOR_Report()); |
|
43
|
|
|
$this->assertTrue(true); |
|
44
|
|
|
} |
|
45
|
|
|
catch (Exception $e) { |
|
46
|
|
|
$this->fail(); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
?> |
|
54
|
|
|
|