コード例 #1
0
ファイル: handlerTest.php プロジェクト: thomblin/slimline
 /**
  * testShouldGetFoundRows
  *
  * @param $debug
  *
  * @dataProvider getResponseDebugSql
  * @covers de\detert\sebastian\slimline\db\Handler::getAffectedRows
  */
 public function testShouldGetFoundRows(Response_Debug_Sql $debug = null)
 {
     $handler = new Handler($this->dbConfig);
     if (!is_null($debug)) {
         $handler->setDebugResponse($debug);
     }
     $sql = 'CREATE TABLE IF NOT EXISTS `foo` (`id` INT(20))';
     $this->handler->query($sql);
     $sql = 'INSERT INTO `foo` VALUES (?), (?)';
     $params = array(1, 2);
     $handler->query($sql, $params);
     $handler->query("SELECT SQL_CALC_FOUND_ROWS * FROM `foo` LIMIT 1");
     $this->assertEquals(2, $handler->getFoundRows());
 }