Commit 1f5456a9 authored by Tiago Brito's avatar Tiago Brito

Merge pull request #6 from doctrine/master

Update from master repository
parents 9c918572 7175964c
......@@ -19,7 +19,6 @@
namespace Doctrine\DBAL\Portability;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Cache\QueryCacheProfile;
/**
......
......@@ -1312,7 +1312,9 @@ class QueryBuilder
. ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias']
. ' ON ' . ((string) $join['joinCondition']);
$knownAliases[$join['joinAlias']] = true;
}
foreach ($this->sqlParts['join'][$fromAlias] as $join) {
$sql .= $this->getSQLForJoins($join['joinAlias'], $knownAliases);
}
}
......
......@@ -22,7 +22,6 @@ namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Events;
use Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs;
use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs;
use Doctrine\DBAL\Types;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
......
......@@ -2,11 +2,9 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema;
require_once __DIR__ . '/../../../TestInit.php';
class Db2SchemaManagerTest extends SchemaManagerFunctionalTestCase
{
}
\ No newline at end of file
}
......@@ -3,9 +3,9 @@
namespace Doctrine\Tests\DBAL\Mocks;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class MockPlatform extends \Doctrine\DBAL\Platforms\AbstractPlatform
class MockPlatform extends AbstractPlatform
{
/**
* Gets the SQL Snippet used to declare a BLOB column type.
......
......@@ -678,6 +678,60 @@ class QueryBuilderTest extends \Doctrine\Tests\DbalTestCase
$this->assertEquals('SELECT DISTINCT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles a INNER JOIN comments c ON c.article_id = a.id WHERE (u.id = a.user_id) AND (p.read = 1)', $qb->getSQL());
}
/**
* @group DBAL-774
*/
public function testSelectWithJoinsWithMultipleOnConditionsParseOrder()
{
$qb = new QueryBuilder($this->conn);
$qb->select('a.id')
->from('table_a', 'a')
->join('a', 'table_b', 'b', 'a.fk_b = b.id')
->join('b', 'table_c', 'c', 'c.fk_b = b.id AND b.language = ?')
->join('a', 'table_d', 'd', 'a.fk_d = d.id')
->join('c', 'table_e', 'e', 'e.fk_c = c.id AND e.fk_d = d.id');
$this->assertEquals(
'SELECT a.id ' .
'FROM table_a a ' .
'INNER JOIN table_b b ON a.fk_b = b.id ' .
'INNER JOIN table_d d ON a.fk_d = d.id ' .
'INNER JOIN table_c c ON c.fk_b = b.id AND b.language = ? ' .
'INNER JOIN table_e e ON e.fk_c = c.id AND e.fk_d = d.id',
(string) $qb
);
}
/**
* @group DBAL-774
*/
public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParseOrder()
{
$qb = new QueryBuilder($this->conn);
$qb->select('a.id')
->from('table_a', 'a')
->from('table_f', 'f')
->join('a', 'table_b', 'b', 'a.fk_b = b.id')
->join('b', 'table_c', 'c', 'c.fk_b = b.id AND b.language = ?')
->join('a', 'table_d', 'd', 'a.fk_d = d.id')
->join('c', 'table_e', 'e', 'e.fk_c = c.id AND e.fk_d = d.id')
->join('f', 'table_g', 'g', 'f.fk_g = g.id');
$this->assertEquals(
'SELECT a.id ' .
'FROM table_a a ' .
'INNER JOIN table_b b ON a.fk_b = b.id ' .
'INNER JOIN table_d d ON a.fk_d = d.id ' .
'INNER JOIN table_c c ON c.fk_b = b.id AND b.language = ? ' .
'INNER JOIN table_e e ON e.fk_c = c.id AND e.fk_d = d.id, ' .
'table_f f ' .
'INNER JOIN table_g g ON f.fk_g = g.id',
(string) $qb
);
}
public function testClone()
{
$qb = new QueryBuilder($this->conn);
......
......@@ -5,7 +5,6 @@ namespace Doctrine\Tests\DBAL\Schema;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
use Doctrine\Tests\DBAL\Mocks;
class MySqlSchemaManagerTest extends \PHPUnit_Framework_TestCase
{
......
......@@ -5,7 +5,6 @@ namespace Doctrine\Tests\DBAL\Schema;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\Tests\DBAL\Mocks;
class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
{
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class ArrayTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('array');
}
......@@ -58,4 +58,4 @@ class ArrayTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -24,7 +24,7 @@ class BinaryTest extends \Doctrine\Tests\DbalTestCase
*/
protected function setUp()
{
$this->platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->platform = new MockPlatform();
$this->type = Type::getType('binary');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -24,7 +24,7 @@ class BlobTest extends \Doctrine\Tests\DbalTestCase
*/
protected function setUp()
{
$this->platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->platform = new MockPlatform();
$this->type = Type::getType('blob');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class BooleanTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('boolean');
}
......@@ -33,4 +33,4 @@ class BooleanTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -16,7 +16,7 @@ class DateTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('date');
$this->_tz = date_default_timezone_get();
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class DateTimeTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('datetime');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class DateTimeTzTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('datetimetz');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('decimal');
}
......@@ -28,4 +28,4 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -13,7 +13,7 @@ class FloatTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('float');
}
......@@ -36,4 +36,4 @@ class FloatTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertNull($this->_type->convertToDatabaseValue(null, $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
class GuidTest extends \Doctrine\Tests\DbalTestCase
{
......@@ -13,7 +13,7 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('guid');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('integer');
}
......@@ -29,4 +29,4 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class ObjectTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('object');
}
......@@ -53,4 +53,4 @@ class ObjectTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class SmallIntTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('smallint');
}
......@@ -29,4 +29,4 @@ class SmallIntTest extends \Doctrine\Tests\DbalTestCase
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class StringTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('string');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class TimeTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
$this->_type = Type::getType('time');
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
require_once __DIR__ . '/../../TestInit.php';
......@@ -15,7 +15,7 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase
protected function setUp()
{
$this->_platform = new \Doctrine\Tests\DBAL\Mocks\MockPlatform();
$this->_platform = new MockPlatform();
if (!Type::hasType('vardatetime')) {
Type::addType('vardatetime', 'Doctrine\DBAL\Types\VarDateTimeType');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment