projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
APIv4 - Support pseudoconstant suffixes in orderBy clause
[civicrm-core.git]
/
tests
/
phpunit
/
api
/
v4
/
Action
/
BasicActionsTest.php
diff --git
a/tests/phpunit/api/v4/Action/BasicActionsTest.php
b/tests/phpunit/api/v4/Action/BasicActionsTest.php
index de06f6882e9c8b46c596b5ac4de52d88eff96e88..daf2b3470eab21374bdc9d995b1a503772a0aeb4 100644
(file)
--- a/
tests/phpunit/api/v4/Action/BasicActionsTest.php
+++ b/
tests/phpunit/api/v4/Action/BasicActionsTest.php
@@
-266,6
+266,7
@@
class BasicActionsTest extends UnitTestCase {
$results = MockBasicEntity::get()
->addSelect('*', 'group:label', 'group:name', 'fruit:name', 'fruit:color', 'fruit:label')
$results = MockBasicEntity::get()
->addSelect('*', 'group:label', 'group:name', 'fruit:name', 'fruit:color', 'fruit:label')
+ ->addOrderBy('fruit:color', "DESC")
->execute();
$this->assertEquals('round', $results[0]['shape']);
->execute();
$this->assertEquals('round', $results[0]['shape']);
@@
-277,6
+278,12
@@
class BasicActionsTest extends UnitTestCase {
$this->assertEquals('banana', $results[0]['fruit:name']);
$this->assertEquals('yellow', $results[0]['fruit:color']);
$this->assertEquals('banana', $results[0]['fruit:name']);
$this->assertEquals('yellow', $results[0]['fruit:color']);
+ // Reverse order
+ $results = MockBasicEntity::get()
+ ->addOrderBy('fruit:color')
+ ->execute();
+ $this->assertEquals('two', $results[0]['group']);
+
// Cannot match to a non-unique option property like :color on create
try {
MockBasicEntity::create()->addValue('fruit:color', 'yellow')->execute();
// Cannot match to a non-unique option property like :color on create
try {
MockBasicEntity::create()->addValue('fruit:color', 'yellow')->execute();