mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
28 lines
905 B
PHP
28 lines
905 B
PHP
<?php
|
|
|
|
namespace SilverStripe\ORM\Tests;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\ORM\Connect\DBQueryBuilder;
|
|
use SilverStripe\ORM\Queries\SQLSelect;
|
|
|
|
class DBQueryBuilderTest extends SapphireTest
|
|
{
|
|
protected $usesDatabase = false;
|
|
|
|
public function testMultilineJoin()
|
|
{
|
|
$join = <<<JOIN
|
|
INNER JOIN
|
|
(SELECT DISTINCT "SiteTreeLink"."ClassName", "SiteTreeLink"."LastEdited", "SiteTreeLink"."Created", "SiteTreeLink"."LinkedID",
|
|
"SiteTreeLink"."ParentID", "SiteTreeLink"."ParentClass", "SiteTreeLink"."ID" FROM "SiteTreeLink")
|
|
AS "SiteTreeLink" ON "SiteTreeLink"."LinkedID" = "SiteTree"."ID"
|
|
JOIN;
|
|
$select = new SQLSelect('*', ['SomeTable', $join]);
|
|
$builder = new DBQueryBuilder();
|
|
|
|
$params = [];
|
|
$this->assertSame('FROM SomeTable ' . $join, trim($builder->buildFromFragment($select, $params)));
|
|
}
|
|
}
|