public function testFirst() { $this->initConnection(); $all = Books::select()->all(); $count = $all->count(); $result = $all->first()->data(); $expected = "array('book_id'=>'1','name'=>'LearningPHP,MySQL&JavaScript:WithjQuery,CSS&HTML5','release_date'=>NULL,'format_id'=>NULL,)"; $this->assertEquals($expected, $this->inline($result)); }
public function testIsNull() { $this->initConnection(); $select = Books::select()->isNull('release_date'); $result = $select->fetchAll(); $result = $this->inline($result); $expected = "array(0=>array('book_id'=>'1','name'=>'LearningPHP,MySQL&JavaScript:WithjQuery,CSS&HTML5','release_date'=>NULL,'format_id'=>NULL,),1=>array('book_id'=>'2','name'=>'We\\'reAllDamaged','release_date'=>NULL,'format_id'=>NULL,),)"; $this->assertEquals($expected, $result); $select = Books::select()->isNotNull('release_date'); $result = $select->fetchAll(); $result = $this->inline($result); $expected = "array(0=>array('book_id'=>'3','name'=>'JavaScriptandJQuery:InteractiveFront-EndWebDevelopment','release_date'=>'2016-06-06','format_id'=>NULL,),)"; $this->assertEquals($expected, $result); }