本文整理匯總了PHP中TYPO3\CMS\Core\Tests\AccessibleObjectInterface::INSERTmultipleRows方法的典型用法代碼示例。如果您正苦於以下問題:PHP AccessibleObjectInterface::INSERTmultipleRows方法的具體用法?PHP AccessibleObjectInterface::INSERTmultipleRows怎麽用?PHP AccessibleObjectInterface::INSERTmultipleRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\Tests\AccessibleObjectInterface
的用法示例。
在下文中一共展示了AccessibleObjectInterface::INSERTmultipleRows方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sqlForInsertWithMultipleRowsIsValid
/**
* @test
*/
public function sqlForInsertWithMultipleRowsIsValid()
{
$fields = array('uid', 'pid', 'title', 'body');
$rows = array(array('1', '2', 'Title #1', 'Content #1'), array('3', '4', 'Title #2', 'Content #2'), array('5', '6', 'Title #3', 'Content #3'));
$result = $this->subject->INSERTmultipleRows('tt_content', $fields, $rows);
$expected = 'INSERT INTO tt_content (uid, pid, title, body) VALUES ';
$expected .= '(\'1\', \'2\', \'Title #1\', \'Content #1\'), ';
$expected .= '(\'3\', \'4\', \'Title #2\', \'Content #2\'), ';
$expected .= '(\'5\', \'6\', \'Title #3\', \'Content #3\')';
$this->assertEquals($expected, $this->cleanSql($result));
}
示例2: sqlForInsertWithMultipleRowsIsValid
/**
* @test
*/
public function sqlForInsertWithMultipleRowsIsValid()
{
$fields = array('uid', 'pid', 'title', 'body');
$rows = array(array('1', '2', 'Title #1', 'Content #1'), array('3', '4', 'Title #2', 'Content #2'), array('5', '6', 'Title #3', 'Content #3'));
$result = $this->subject->INSERTmultipleRows('tt_content', $fields, $rows);
$expected[0] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'1\', \'2\', \'Title #1\', \'Content #1\' )';
$expected[1] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'3\', \'4\', \'Title #2\', \'Content #2\' )';
$expected[2] = 'INSERT INTO "tt_content" ( "uid", "pid", "title", "body" ) VALUES ( \'5\', \'6\', \'Title #3\', \'Content #3\' )';
$this->assertEquals(count($expected), count($result));
for ($i = 0; $i < count($result); $i++) {
$this->assertTrue(is_array($result[$i]), 'Expected array: ' . $result[$i]);
$this->assertEquals(1, count($result[$i]));
$this->assertEquals($expected[$i], $this->cleanSql($result[$i][0]));
}
}