| 1 | <?php |
||
| 3 | class ViewPopupTest extends PHPUnit_Framework_TestCase |
||
| 4 | { |
||
| 5 | |||
| 6 | public function testViewPopup(){ |
||
| 7 | |||
| 8 | //execute the contructor and check for the Object type and type attribute |
||
| 9 | $view = new ViewPopup(); |
||
| 10 | $this->assertInstanceOf('ViewPopup',$view); |
||
| 11 | $this->assertInstanceOf('SugarView',$view); |
||
| 12 | $this->assertAttributeEquals('list','type', $view); |
||
| 13 | |||
| 14 | unset($view); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function testdisplay(){ |
||
| 18 | |||
| 19 | //error_reporting(E_ERROR | E_PARSE |E_ALL); |
||
| 20 | |||
| 21 | //execute the method with required child objects preset. it should return some html. |
||
| 22 | $view = new ViewPopup(); |
||
| 23 | $view->module = "Accounts"; |
||
| 24 | |||
| 25 | try{ |
||
| 26 | $view->bean = new Account(); |
||
| 27 | } |
||
| 28 | Catch(Exception $e){ |
||
| 29 | $this->assertStringStartsWith('mysqli_query()',$e->getMessage()); |
||
| 30 | } |
||
| 31 | |||
| 32 | ob_start(); |
||
| 33 | |||
| 34 | $view->display(); |
||
| 35 | |||
| 36 | $renderedContent = ob_get_contents(); |
||
| 37 | ob_end_clean(); |
||
| 38 | |||
| 39 | $this->assertGreaterThan(0,strlen($renderedContent)); |
||
| 40 | |||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 |