-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX Match multi-line JOIN statements
- Loading branch information
1 parent
157317d
commit 142035f
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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))); | ||
} | ||
} |