本文整理汇总了PHP中PMA\libraries\Table::checkIfMinRecordsExist方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::checkIfMinRecordsExist方法的具体用法?PHP Table::checkIfMinRecordsExist怎么用?PHP Table::checkIfMinRecordsExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA\libraries\Table
的用法示例。
在下文中一共展示了Table::checkIfMinRecordsExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCheckIfMinRecordsExist
/**
* Test for checkIfMinRecordsExist
*
* @return void
*/
public function testCheckIfMinRecordsExist()
{
$old_dbi = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder('PMA\libraries\DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('tryQuery')
->will($this->returnValue('res'));
$dbi->expects($this->any())
->method('numRows')
->willReturnOnConsecutiveCalls(
0,
10,
200
);
$dbi->expects($this->any())
->method('fetchResult')
->willReturnOnConsecutiveCalls(
array('`one_pk`'),
array(), // No Uniques found
array('`one_ind`', '`sec_ind`'),
array(), // No Uniques found
array() // No Indexed found
);
$GLOBALS['dbi'] = $dbi;
$table = 'PMA_BookMark';
$db = 'PMA';
$tableObj = new Table($table, $db);
// Case 1 : Check if table is non-empty
$return = $tableObj->checkIfMinRecordsExist();
$expect = true;
$this->assertEquals(
$expect,
$return
);
// Case 2 : Check if table contains at least 100
$return = $tableObj->checkIfMinRecordsExist(100);
$expect = false;
$this->assertEquals(
$expect,
$return
);
// Case 3 : Check if table contains at least 100
$return = $tableObj->checkIfMinRecordsExist(100);
$expect = true;
$this->assertEquals(
$expect,
$return
);
$GLOBALS['dbi'] = $old_dbi;
}