projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #17872 from eileenmcnaughton/ids
[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..b71f2683a787b55783c305ef56643eb8f9d574ee 100644
(file)
--- a/
tests/phpunit/api/v4/Action/BasicActionsTest.php
+++ b/
tests/phpunit/api/v4/Action/BasicActionsTest.php
@@
-45,7
+45,9
@@
class BasicActionsTest extends UnitTestCase {
MockBasicEntity::update()->addWhere('id', '=', $id2)->addValue('foo', 'new')->execute();
$result = MockBasicEntity::get()->addOrderBy('id', 'DESC')->setLimit(1)->execute();
MockBasicEntity::update()->addWhere('id', '=', $id2)->addValue('foo', 'new')->execute();
$result = MockBasicEntity::get()->addOrderBy('id', 'DESC')->setLimit(1)->execute();
- $this->assertCount(1, $result);
+ // The object's count() method will account for all results, ignoring limit, while the array results are limited
+ $this->assertCount(2, $result);
+ $this->assertCount(1, (array) $result);
$this->assertEquals('new', $result->first()['foo']);
$result = MockBasicEntity::save()
$this->assertEquals('new', $result->first()['foo']);
$result = MockBasicEntity::save()
@@
-266,6
+268,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
+280,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();