Completed
Push — CI ( ee6bd7...0f01dd )
by Adam
22:32
created

ViewMultieditTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 52
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testViewMultiedit() 0 8 1
B testdisplay() 0 40 1
1
<?php
2
3
4
 class ViewMultieditTest  extends PHPUnit_Framework_TestCase{
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
Expected 1 space after class name; 2 found
Loading history...
Coding Style introduced by
Expected 1 space before extends keyword; 2 found
Loading history...
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
 	
0 ignored issues
show
Coding Style introduced by
There is some trailing whitespace on this line which should be avoided as per coding-style.
Loading history...
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
 		/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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