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

ViewClassicTest::testdisplay()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 42
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 42
rs 8.8571
c 1
b 0
f 1
cc 1
eloc 25
nc 1
nop 0
1
<?php
2
3
class ViewClassicTest 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...
4
{
5
6
    public function test__construct( )
7
    {
8
    	//execute the contructor and check for the Object type and type attribute
9
    	
10
    	//test with no paramerters
11
    	$view = new ViewClassic();
12
    	$this->assertInstanceOf('ViewClassic',$view);
13
    	$this->assertInstanceOf('SugarView',$view);
14
    	$this->assertAttributeEquals('','type', $view);
15
16
    	
17
    	//test with bean parameter;
18
    	$bean = new User();
19
    	$view = new ViewClassic($bean);
20
    	$this->assertInstanceOf('ViewClassic',$view);
21
    	$this->assertInstanceOf('SugarView',$view);
22
    	$this->assertAttributeEquals('','type', $view);
23
    		
24
 	}
25
 	
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...
26
27
    public function testdisplay()
28
    {
29
    	error_reporting(E_ERROR | E_PARSE);
30
31
    	
32
    	//test with a valid module but invalid action. it should return false.
33
    	$view = new ViewClassic();
34
    	$view->module = "Home";
35
    	$view->action = "";	 
36
    	$ret = $view->display();
37
    	$this->assertFalse($ret);
38
    	
39
40
    	
41
    	//test with a valid module and uncustomized action. it should return true
42
    	$view = new ViewClassic();
43
    	$view->module = "Home";
44
    	$view->action = "About";
45
    	
46
    	ob_start();
47
    	$ret = $view->display();
48
    	$renderedContent = ob_get_contents();
49
    	ob_end_clean();
50
    	$this->assertGreaterThan(0,strlen($renderedContent));
51
    	$this->assertTrue($ret);
52
    
53
    	
54
    	
55
    	//test with a valid module and customized action. it should return true
56
    	$view = new ViewClassic();
57
    	$view->module = "Home";
58
    	$view->action = "index";
59
60
    	ob_start();
61
    	$ret = $view->display();
62
    	$renderedContent = ob_get_contents();
63
    	ob_end_clean();
64
    	$this->assertGreaterThan(0,strlen($renderedContent));
65
    	$this->assertTrue($ret);
66
    	
67
    	
68
    }
69
}
70