Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX Use OR conjuctive in filterAny aggregate queries
- Loading branch information
1 parent
7210ac8
commit 696fe79
Showing
6 changed files
with
177 additions
and
20 deletions.
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
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
*/ | ||
class ManyManyList extends RelationList | ||
{ | ||
|
||
/** | ||
* @var string $joinTable | ||
*/ | ||
|
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,45 @@ | ||
<?php | ||
|
||
namespace SilverStripe\ORM\Tests; | ||
|
||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\ORM\DataQuery; | ||
use SilverStripe\ORM\DataQuery_SubGroup; | ||
use SilverStripe\ORM\DataObject; | ||
use SilverStripe\ORM\Tests\DataObjectTest\Team; | ||
use LogicException; | ||
use InvalidArgumentException; | ||
|
||
class DataQuery_SubGroupTest extends SapphireTest | ||
{ | ||
public function testConstructorException() | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('$clause must be either WHERE or HAVING'); | ||
new DataQuery_SubGroup(new DataQuery(Team::class), 'AND', 'INVALID'); | ||
} | ||
|
||
public function testWhereException() | ||
{ | ||
$this->expectException(LogicException::class); | ||
$this->expectExceptionMessage('Cannot call where() when clause is set to HAVING'); | ||
$query = new DataQuery_SubGroup(new DataQuery(Team::class), 'AND', 'HAVING'); | ||
$query->where([]); | ||
} | ||
|
||
public function testWhereAnyException() | ||
{ | ||
$this->expectException(LogicException::class); | ||
$this->expectExceptionMessage('Cannot call whereAny() when clause is set to HAVING'); | ||
$query = new DataQuery_SubGroup(new DataQuery(Team::class), 'AND', 'HAVING'); | ||
$query->whereAny([]); | ||
} | ||
|
||
public function testHavingException() | ||
{ | ||
$this->expectException(LogicException::class); | ||
$this->expectExceptionMessage('Cannot call having() when clause is set to WHERE'); | ||
$query = new DataQuery_SubGroup(new DataQuery(Team::class), 'AND', 'WHERE'); | ||
$query->having([]); | ||
} | ||
} |