本文整理汇总了PHP中PHPUnit_Extensions_Database_DataSet_ITable::getTableMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Extensions_Database_DataSet_ITable::getTableMetaData方法的具体用法?PHP PHPUnit_Extensions_Database_DataSet_ITable::getTableMetaData怎么用?PHP PHPUnit_Extensions_Database_DataSet_ITable::getTableMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Extensions_Database_DataSet_ITable
的用法示例。
在下文中一共展示了PHPUnit_Extensions_Database_DataSet_ITable::getTableMetaData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildOperationQuery
protected function buildOperationQuery(PHPUnit_Extensions_Database_DataSet_ITableMetaData $databaseTableMetaData, PHPUnit_Extensions_Database_DataSet_ITable $table, PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection)
{
$keys = $databaseTableMetaData->getPrimaryKeys();
$whereStatement = 'WHERE ' . implode(' AND ', $this->buildPreparedColumnArray($keys, $connection));
$query = "\n\t\t\tDELETE FROM {$connection->quoteSchemaObject($table->getTableMetaData()->getTableName())}\n\t\t\t{$whereStatement}\n\t\t";
return $query;
}
示例2: buildOperationQuery
protected function buildOperationQuery(PHPUnit_Extensions_Database_DataSet_ITableMetaData $databaseTableMetaData, PHPUnit_Extensions_Database_DataSet_ITable $table)
{
$keys = $databaseTableMetaData->getPrimaryKeys();
$whereStatement = 'WHERE ' . implode(' AND ', $this->buildPreparedColumnArray($keys));
$query = "\n \tSELECT COUNT(*)\n \tFROM {$table->getTableMetaData()->getTableName()}\n \t{$whereStatement}\n ";
return $query;
}
示例3: buildOperationArguments
protected function buildOperationArguments(PHPUnit_Extensions_Database_DataSet_ITableMetaData $databaseTableMetaData, PHPUnit_Extensions_Database_DataSet_ITable $table, $row)
{
$args = array();
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
$args[] = $table->getValue($row, $columnName);
}
return $args;
}
示例4: buildInsertValues
/**
*
* @param PHPUnit_Extensions_Database_DataSet_ITable $table
* @param int $rowNum
* @return array
*/
protected function buildInsertValues(\PHPUnit_Extensions_Database_DataSet_ITable $table, $rowNum)
{
$values = array();
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
$values[$columnName] = $table->getValue($rowNum, $columnName);
}
return $values;
}
示例5: row
/**
* Override to save a table row.
*
* @param array $row
* @param PHPUnit_Extensions_Database_DataSet_ITable $table
*/
protected function row(array $row, PHPUnit_Extensions_Database_DataSet_ITable $table)
{
fwrite($this->fh, "\t<{$table->getTableMetaData()->getTableName()}\n");
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
if (isset($row[$columnName])) {
fwrite($this->fh, "\t\t{$columnName}=\"" . htmlspecialchars($row[$columnName]) . "\"\n");
}
}
fwrite($this->fh, "\t/>\n");
}
示例6: buildInsertValues
/**
*
* @param \PHPUnit_Extensions_Database_DataSet_ITable $table
* @param int $rowNum
* @return array
*/
protected function buildInsertValues(\PHPUnit_Extensions_Database_DataSet_ITable $table, $rowNum)
{
$values = array();
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
try {
$values[$columnName] = $table->getValue($rowNum, $columnName);
} catch (FixtureValueNotExistsException $doNothing) {
}
}
return $values;
}
示例7: matches
/**
* Asserts that the given table matches this table.
*
* @param PHPUnit_Extensions_Database_DataSet_ITable $other
*/
public function matches(PHPUnit_Extensions_Database_DataSet_ITable $other)
{
$thisMetaData = $this->getTableMetaData();
$otherMetaData = $other->getTableMetaData();
if (!$thisMetaData->matches($otherMetaData) || $this->getRowCount() != $other->getRowCount()) {
return FALSE;
}
$columns = $thisMetaData->getColumns();
$rowCount = $this->getRowCount();
for ($i = 0; $i < $rowCount; $i++) {
foreach ($columns as $columnName) {
if ($this->getValue($i, $columnName) != $other->getValue($i, $columnName)) {
return FALSE;
}
}
}
return TRUE;
}
示例8: row
/**
* Override to save a table row.
*
* @param array $row
* @param PHPUnit_Extensions_Database_DataSet_ITable $table
*/
protected function row(array $row, PHPUnit_Extensions_Database_DataSet_ITable $table)
{
fwrite($this->fh, "\t" . '<row>' . "\n");
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
fwrite($this->fh, "\t\t" . '<field name="' . $columnName . '"');
if (isset($row[$columnName])) {
fwrite($this->fh, '>' . htmlspecialchars($row[$columnName]) . '</field>' . "\n");
} else {
fwrite($this->fh, ' xsi:nil="true" />' . "\n");
}
}
fwrite($this->fh, "\t" . '</row>' . "\n");
}
示例9: __construct
/**
* Creates a new table filter using the original table
*
* @param $originalTable PHPUnit_Extensions_Database_DataSet_ITable
* @param $excludeColumns Array @deprecated, use the set* methods instead.
*/
public function __construct(PHPUnit_Extensions_Database_DataSet_ITable $originalTable, array $excludeColumns = array())
{
$this->originalTable = $originalTable;
$this->setTableMetaData(new PHPUnit_Extensions_Database_DataSet_TableMetaDataFilter($originalTable->getTableMetaData()));
$this->addExcludeColumns($excludeColumns);
}
示例10: assertEquals
/**
* Asserts that the given table matches this table.
*
* @param PHPUnit_Extensions_Database_DataSet_ITable $other
*/
public function assertEquals(PHPUnit_Extensions_Database_DataSet_ITable $other)
{
$thisMetaData = $this->getTableMetaData();
$otherMetaData = $other->getTableMetaData();
$thisMetaData->assertEquals($otherMetaData);
if ($this->getRowCount() != $other->getRowCount()) {
throw new Exception("Expected row count of {$this->getRowCount()}, has a row count of {$other->getRowCount()}");
}
$columns = $thisMetaData->getColumns();
for ($i = 0; $i < $this->getRowCount(); $i++) {
foreach ($columns as $columnName) {
if ($this->getValue($i, $columnName) != $other->getValue($i, $columnName)) {
throw new Exception("Expected value of {$this->getValue($i, $columnName)} for row {$i} column {$columnName}, has a value of {$other->getValue($i, $columnName)}");
}
}
}
return TRUE;
}
示例11: row
/**
* Override to save a table row.
*
* @param array $row
* @param PHPUnit_Extensions_Database_DataSet_ITable $table
*/
protected function row(array $row, PHPUnit_Extensions_Database_DataSet_ITable $table)
{
fwrite($this->fh, "\t\t<row>\n");
foreach ($table->getTableMetaData()->getColumns() as $columnName) {
if (isset($row[$columnName])) {
fwrite($this->fh, "\t\t\t<value>" . htmlspecialchars($row[$columnName]) . "</value>\n");
} else {
fwrite($this->fh, "\t\t\t<null />\n");
}
}
fwrite($this->fh, "\t\t</row>\n");
}