| Conditions | 2 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | function testViewSugarpdf(){ |
||
| 8 | error_reporting(E_ERROR | E_WARNING | E_PARSE); |
||
| 9 | |||
| 10 | //execute the method without request parameters and test if it works. it should output some headers and throw headers output exception. |
||
| 11 | try { |
||
| 12 | $view = new ViewSugarpdf(); |
||
| 13 | |||
| 14 | } catch (Exception $e) { |
||
| 15 | $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
||
| 16 | |||
| 17 | } |
||
| 18 | $this->assertEquals(Null,$view); |
||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | //execute the method with request parameters and test if it works. |
||
| 23 | $_REQUEST["sugarpdf"] = 'someValue'; |
||
| 24 | $view = new ViewSugarpdf(); |
||
| 25 | $view->module = "Users"; |
||
| 26 | $this->assertInstanceOf('ViewSugarpdf',$view); |
||
| 27 | $this->assertInstanceOf('SugarView',$view); |
||
| 28 | $this->assertAttributeEquals('sugarpdf','type', $view); |
||
| 29 | $this->assertAttributeEquals('someValue','sugarpdf', $view); |
||
| 30 | $this->assertAttributeEquals(NULL,'sugarpdfBean', $view); |
||
| 31 | |||
| 32 | } |
||
| 33 | |||
| 47 |
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.