|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
class AOR_FieldTest extends PHPUnit_Framework_TestCase { |
|
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
public function testAOR_Field(){ |
|
7
|
|
|
|
|
8
|
|
|
//execute the contructor and check for the Object type and attributes |
|
9
|
|
|
$aor_Field = new AOR_Field(); |
|
10
|
|
|
$this->assertInstanceOf('AOR_Field',$aor_Field); |
|
11
|
|
|
$this->assertInstanceOf('Basic',$aor_Field); |
|
12
|
|
|
$this->assertInstanceOf('SugarBean',$aor_Field); |
|
13
|
|
|
|
|
14
|
|
|
$this->assertAttributeEquals('AOR_Fields', 'module_dir', $aor_Field); |
|
15
|
|
|
$this->assertAttributeEquals('AOR_Field', 'object_name', $aor_Field); |
|
16
|
|
|
$this->assertAttributeEquals('aor_fields', 'table_name', $aor_Field); |
|
17
|
|
|
$this->assertAttributeEquals(true, 'new_schema', $aor_Field); |
|
18
|
|
|
$this->assertAttributeEquals(true, 'disable_row_level_security', $aor_Field); |
|
19
|
|
|
$this->assertAttributeEquals(true, 'importable', $aor_Field); |
|
20
|
|
|
$this->assertAttributeEquals(false, 'tracker_visibility', $aor_Field); |
|
21
|
|
|
|
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function testsave_lines(){ |
|
25
|
|
|
|
|
26
|
|
|
error_reporting(E_ERROR | E_PARSE); |
|
27
|
|
|
|
|
28
|
|
|
$aor_Field = new AOR_Field(); |
|
29
|
|
|
|
|
30
|
|
|
//preset the required data |
|
31
|
|
|
$post_data = Array(); |
|
32
|
|
|
$post_data['field'][] = 'test field'; |
|
33
|
|
|
$post_data['name'][] = 'test'; |
|
34
|
|
|
$post_data['module_path'][] = 'test path'; |
|
35
|
|
|
$post_data['display'][] = '1'; |
|
36
|
|
|
$post_data['link'][] = '1'; |
|
37
|
|
|
$post_data['label'][] = 'test label'; |
|
38
|
|
|
$post_data['field_function'][] = 'test function'; |
|
39
|
|
|
$post_data['total'][] = 'total'; |
|
40
|
|
|
$post_data['group_by'][] = '1'; |
|
41
|
|
|
$post_data['group_order'][] = 'desc'; |
|
42
|
|
|
$post_data['group_display'][] = '1'; |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
//execute the method and test if it works and does not throws an exception. |
|
46
|
|
|
try { |
|
47
|
|
|
$aor_Field->save_lines($post_data, new AOR_Report()); |
|
48
|
|
|
$this->assertTrue(true); |
|
49
|
|
|
} |
|
50
|
|
|
catch (Exception $e) { |
|
51
|
|
|
$this->fail(); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
?> |
|
59
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.