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

ViewQuickcreateTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
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 54
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
B testpreDisplay() 0 24 1
A testdisplay() 0 23 1
1
<?php
2
3
class ViewQuickcreateTest 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 testpreDisplay() 
7
    {
8
 
9
    	//check without setting any values, it should execute without any issues.
10
    	$view = new ViewQuickcreate();
11
    	$view->preDisplay();
12
    	$this->assertEquals(0,count($_REQUEST));
13
    	 
14
    	//check with values preset but without a valid bean id, it sould not change Request parameters
15
    	$_REQUEST['source_module'] = "Users";
16
    	$_REQUEST['module']= 'Users';
17
    	$_REQUEST['record'] = '';
18
    	$request = $_REQUEST;
19
    	 
20
    	$view->preDisplay();
21
    	$this->assertSame($request,$_REQUEST);
22
    	
23
    	//check with values preset, it sould set some addiiotnal Request parameters
24
    	$_REQUEST['record'] = 1;
25
    	$view->preDisplay();
26
    	$this->assertNotSame($request,$_REQUEST);
27
    	
28
    	
29
    }    
30
    
31
    public function testdisplay()
32
    {
33
 
34
    	error_reporting(E_ERROR | E_PARSE);
35
36
    	//execute the method with required child objects and parameters preset. it will return some html.
37
    	$view = new ViewQuickcreate();
38
    	 
39
    	$_REQUEST['module']= 'Accounts';
40
    	$view->bean = new Account();
41
    	 
42
    	ob_start();
43
    	 
44
    	$view->display();
45
    	 
46
    	$renderedContent = ob_get_contents();
47
    	ob_end_clean();
48
    	 
49
    	$this->assertGreaterThan(0,strlen($renderedContent));
50
    	$this->assertEquals(False,json_decode($renderedContent)); //check that it doesn't return json. 
51
    	
52
    	
53
	}
54
55
 
56
}