Skip to content

Commit

Permalink
Merge pull request #3 from doctrine/master
Browse files Browse the repository at this point in the history
Update from master repository
  • Loading branch information
Tiago Brito committed Jul 29, 2014
2 parents 7b29bd5 + 663135d commit 907513f
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 79 deletions.
22 changes: 11 additions & 11 deletions tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testPrimaryConstraintViolationException()
$table->addColumn('id', 'integer', array());
$table->setPrimaryKey(array('id'));

foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -46,10 +46,10 @@ public function testTableExistsException()
$table->setPrimaryKey(array('id'));

$this->setExpectedException('\Doctrine\DBAL\Exception\TableExistsException');
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}
}
Expand All @@ -72,7 +72,7 @@ public function testForeignKeyContraintViolationException()
$owningTable->setPrimaryKey(array('id'));
$owningTable->addForeignKeyConstraint($table, array('constraint_id'), array('id'));

foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -92,7 +92,7 @@ public function testNotNullConstraintViolationException()
$table->addColumn('value', 'integer', array('notnull' => true));
$table->setPrimaryKey(array('id'));

foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -107,7 +107,7 @@ public function testInvalidFieldNameException()
$table = $schema->createTable("bad_fieldname_table");
$table->addColumn('id', 'integer', array());

foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -125,7 +125,7 @@ public function testNonUniqueFieldNameException()
$table2 = $schema->createTable("ambiguous_list_table_2");
$table2->addColumn('id', 'integer');

foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -142,7 +142,7 @@ public function testUniqueConstraintViolationException()
$table->addColumn('id', 'integer');
$table->addUniqueIndex(array('id'));

foreach ($schema->toSql($this->_conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand All @@ -157,7 +157,7 @@ public function testSyntaxErrorException()
$table->addColumn('id', 'integer', array());
$table->setPrimaryKey(array('id'));

foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand Down Expand Up @@ -195,7 +195,7 @@ public function testConnectionExceptionSqLite($mode, $exceptionClass)
$table->addColumn('id', 'integer');

$this->setExpectedException($exceptionClass);
foreach ($schema->toSql($conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->executeQuery($sql);
}
}
Expand Down Expand Up @@ -236,7 +236,7 @@ public function testConnectionException($params)

$this->setExpectedException('Doctrine\DBAL\Exception\ConnectionException');

foreach ($schema->toSql($conn->getDatabasePlatform()) AS $sql) {
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->executeQuery($sql);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function assertLimitResult($expectedResults, $sql, $limit, $offset, $dete
{
$p = $this->_conn->getDatabasePlatform();
$data = array();
foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) AS $row) {
foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) {
$row = array_change_key_case($row, CASE_LOWER);
$data[] = $row['test_int'];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testConnFetchMode()
public function assertFetchResultRows($rows)
{
$this->assertEquals(2, count($rows));
foreach ($rows AS $row) {
foreach ($rows as $row) {
$this->assertFetchResultRow($row);
}
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setUp()

}
$this->_conn->executeUpdate('DELETE FROM caching');
foreach ($this->expectedResult AS $row) {
foreach ($this->expectedResult as $row) {
$this->_conn->insert('caching', $row);
}

Expand All @@ -50,7 +50,7 @@ public function testCacheFetchAssoc()
public function testFetchNum()
{
$expectedResult = array();
foreach ($this->expectedResult AS $v) {
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_values($v);
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_NUM);
Expand All @@ -59,7 +59,7 @@ public function testFetchNum()
public function testFetchBoth()
{
$expectedResult = array();
foreach ($this->expectedResult AS $v) {
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_merge($v, array_values($v));
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH);
Expand All @@ -68,7 +68,7 @@ public function testFetchBoth()
public function testFetchColumn()
{
$expectedResult = array();
foreach ($this->expectedResult AS $v) {
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_shift($v);
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN);
Expand All @@ -77,7 +77,7 @@ public function testFetchColumn()
public function testMixingFetch()
{
$numExpectedResult = array();
foreach ($this->expectedResult AS $v) {
foreach ($this->expectedResult as $v) {
$numExpectedResult[] = array_values($v);
}
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testListSequences()
$this->assertInternalType('array', $sequences, 'listSequences() should return an array.');

$foundSequence = null;
foreach($sequences AS $sequence) {
foreach($sequences as $sequence) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.');
if(strtolower($sequence->getName()) == 'list_sequences_test_seq') {
$foundSequence = $sequence;
Expand Down Expand Up @@ -104,7 +104,7 @@ public function testListTables()
$this->assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'.");

$foundTable = false;
foreach ($tables AS $table) {
foreach ($tables as $table) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table);
if (strtolower($table->getName()) == 'list_tables_test') {
$foundTable = true;
Expand Down Expand Up @@ -722,7 +722,7 @@ protected function getTestCompositeTable($name)
protected function assertHasTable($tables, $tableName)
{
$foundTable = false;
foreach ($tables AS $table) {
foreach ($tables as $table) {
$this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.');
if (strtolower($table->getName()) == 'list_tables_test_new_name') {
$foundTable = true;
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testDropTemporaryTableNotAutoCommitTransaction()
$table->addColumn("id", "integer");
$table->setPrimaryKey(array('id'));

foreach ($platform->getCreateTableSQL($table) AS $sql) {
foreach ($platform->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand Down Expand Up @@ -87,7 +87,7 @@ public function testCreateTemporaryTableNotAutoCommitTransaction()
$table->addColumn("id", "integer");
$table->setPrimaryKey(array('id'));

foreach ($platform->getCreateTableSQL($table) AS $sql) {
foreach ($platform->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function setUp()
$table->setPrimaryKey(array('id'));

try {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}
} catch(\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function setUp()
$table->addColumn('test_string', 'string', array('notnull' => false));
$table->setPrimaryKey(array('id'));

foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) AS $sql) {
foreach ($this->_conn->getDatabasePlatform()->getCreateTableSQL($table) as $sql) {
$this->_conn->executeQuery($sql);
}
} catch(\Exception $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testGenerateForeignKeySQL()
$tableOld->addUnnamedForeignKeyConstraint('test_foreign', array('foo_id'), array('foo_id'));

$sqls = array();
foreach ($tableOld->getForeignKeys() AS $fk) {
foreach ($tableOld->getForeignKeys() as $fk) {
$sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DbalFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ protected function onNotSuccessfulTest(\Exception $e)
if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) {
$queries = "";
$i = count($this->_sqlLoggerStack->queries);
foreach (array_reverse($this->_sqlLoggerStack->queries) AS $query) {
foreach (array_reverse($this->_sqlLoggerStack->queries) as $query) {
$params = array_map(function($p) { if (is_object($p)) return get_class($p); else return "'".$p."'"; }, $query['params'] ?: array());
$queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL;
$i--;
}

$trace = $e->getTrace();
$traceMsg = "";
foreach($trace AS $part) {
foreach($trace as $part) {
if(isset($part['file'])) {
if(strpos($part['file'], "PHPUnit/") !== false) {
// Beginning with PHPUnit files we don't print the trace anymore.
Expand Down
Loading

0 comments on commit 907513f

Please sign in to comment.