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

ViewQuickeditTest::testdisplay()   B

Complexity

Conditions 3
Paths 14

Size

Total Lines 37
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 37
rs 8.8571
c 1
b 0
f 1
cc 3
eloc 18
nc 14
nop 0
1
<?php
2
3
class ViewQuickeditTest 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
    	//check without setting any values, it should execute without any issues.
9
    	$view = new ViewQuickedit();
10
    	$view->preDisplay();
11
    	$this->assertEquals(0,count($_REQUEST));
12
    	
13
    	//check with values preset but without a valid bean id, it sould not change Request parameters
14
    	$_REQUEST['source_module'] = "Users";
15
    	$_REQUEST['module']= 'Users';
16
    	$_REQUEST['record'] = '';
17
    	$request = $_REQUEST;
18
    	
19
    	$view->preDisplay();
20
    	$this->assertSame($request,$_REQUEST);
21
    
22
    	//check with values preset, it sould set some addiiotnal Request parameters
23
    	$_REQUEST['record'] = 1;
24
    	$view->preDisplay();
25
    	$this->assertNotSame($request,$_REQUEST);
26
       	
27
    }
28
29
 
30
    public function testdisplay()
31
    {	    
32
    	error_reporting(E_ALL);
33
    	//error_reporting(E_ERROR | E_PARSE |E_NOTICE);
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% 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...
34
    	
35
    	//execute the method with required child objects and paramerers preset. it will rteturn some html.
36
    	$view = new ViewQuickedit();
37
    	$_REQUEST['module'] = 'Accounts';
38
    	$_REQUEST['action'] = 'SubpanelCreates';
39
    			
40
    	try{
41
    		$view->bean = new Account();
42
    	}
43
    	Catch(Exception $e){
44
    		$this->assertStringStartsWith('mysqli_query()',$e->getMessage());
45
    	}
46
47
    	
48
    	try{
49
    		ob_start();
50
    		
51
    		$view->display();
52
53
    		$renderedContent = ob_get_contents();
54
    		ob_end_clean();
55
    		 
56
    		$this->assertGreaterThan(0,strlen($renderedContent));
57
    		$this->assertNotEquals(False,json_decode($renderedContent));
58
    	
59
    	}
60
    	Catch(Exception $e){
61
    		$this->assertStringStartsWith('mysqli_query()',$e->getMessage());
62
    	}   	
63
    		
64
65
    	
66
    }
67
68
    
69
}
70