1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
class ViewMultieditTest extends PHPUnit_Framework_TestCase{ |
|
|
|
|
5
|
|
|
|
6
|
|
|
function testViewMultiedit(){ |
7
|
|
|
|
8
|
|
|
//execute the contructor and check for the Object type and type attribute |
9
|
|
|
$view = new ViewMultiedit(); |
10
|
|
|
$this->assertInstanceOf('ViewMultiedit',$view); |
11
|
|
|
$this->assertInstanceOf('SugarView',$view); |
12
|
|
|
$this->assertAttributeEquals('edit','type', $view); |
13
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
function testdisplay(){ |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
//test without action value and modules list in REQUEST object |
19
|
|
|
$view = new ViewMultiedit(); |
20
|
|
|
ob_start(); |
21
|
|
|
$view->display(); |
22
|
|
|
$renderedContent = ob_get_contents(); |
23
|
|
|
ob_end_clean(); |
24
|
|
|
$this->assertEquals(0,strlen($renderedContent)); |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
|
28
|
|
|
//test with valid action value to get link in return |
29
|
|
|
$view = new ViewMultiedit(); |
30
|
|
|
$view->action = 'AjaxFormSave'; |
31
|
|
|
$view->module = 'Users'; |
32
|
|
|
$view->bean = new User(); |
33
|
|
|
$view->bean->id =1; |
34
|
|
|
ob_start(); |
35
|
|
|
$view->display(); |
36
|
|
|
$renderedContent = ob_get_contents(); |
37
|
|
|
ob_end_clean(); |
38
|
|
|
$this->assertGreaterThan(0,strlen($renderedContent)); |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
//Fails with a fatal error, method creates editview without properly setting it up causing fatal errors. |
42
|
|
|
/* |
|
|
|
|
43
|
|
|
//test only with modules list in REQUEST object |
44
|
|
|
$view = new ViewMultiedit(); |
45
|
|
|
$GLOBALS['current_language']= 'en_us'; |
46
|
|
|
$_REQUEST['modules']= Array('Calls','Accounts'); |
47
|
|
|
ob_start(); |
48
|
|
|
$view->display(); |
49
|
|
|
$renderedContent = ob_get_contents(); |
50
|
|
|
ob_end_clean(); |
51
|
|
|
$this->assertGreaterThan(0,strlen($renderedContent)); |
52
|
|
|
*/ |
53
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
?> |
57
|
|
|
|
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.