2009-11-22 06:16:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class DataQueryTest extends SapphireTest {
|
|
|
|
/**
|
2011-10-29 06:11:27 +02:00
|
|
|
* Test the leftJoin() and innerJoin method of the DataQuery object
|
2009-11-22 06:16:38 +01:00
|
|
|
*/
|
2011-10-29 06:11:27 +02:00
|
|
|
function testJoins() {
|
2009-11-22 06:16:38 +01:00
|
|
|
$dq = new DataQuery('Member');
|
2011-10-29 06:11:27 +02:00
|
|
|
$dq->innerJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\"");
|
2009-11-22 06:16:38 +01:00
|
|
|
$this->assertContains("INNER JOIN \"Group_Members\" ON \"Group_Members\".\"MemberID\" = \"Member\".\"ID\"", $dq->sql());
|
2011-10-29 06:11:27 +02:00
|
|
|
|
|
|
|
$dq = new DataQuery('Member');
|
|
|
|
$dq->leftJoin("Group_Members", "\"Group_Members\".\"MemberID\" = \"Member\".\"ID\"");
|
|
|
|
$this->assertContains("LEFT JOIN \"Group_Members\" ON \"Group_Members\".\"MemberID\" = \"Member\".\"ID\"", $dq->sql());
|
2009-11-22 06:16:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|