From 74ec0ddb530525ad675c54234790baa2cc1246f1 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 12 Dec 2016 16:16:28 +1100 Subject: [PATCH] Expand test coverage to include specified ordering --- .../phpunit/api/v3/SyntaxConformanceTest.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 6de9ce1747..a9072bddeb 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -1109,13 +1109,21 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { */ public function testValidSortSingleArrayById_get($Entity) { $invalidEntitys = array('ActivityType', 'Setting', 'System'); - if (in_array($Entity, $invalidEntitys)) { - $this->markTestSkipped('It seems OK for ' . $Entity . ' to skip here as it silently sips invalid params'); + $tests = array( + 'id' => '_id', + 'id desc' => '_id desc', + 'id DESC' => '_id DESC', + 'id ASC' => '_id ASC', + 'id asc' => '_id asc'); + foreach ($tests as $test => $expected) { + if (in_array($Entity, $invalidEntitys)) { + $this->markTestSkipped('It seems OK for ' . $Entity . ' to skip here as it silently ignores passed in params'); + } + $params = array('sort' => array($test)); + $result = _civicrm_api3_get_options_from_params($params, FALSE, $Entity, 'get'); + $lowercase_entity = _civicrm_api_get_entity_name_from_camel($Entity); + $this->assertEquals($lowercase_entity . $expected, $result['sort']); } - $params = array('sort' => array('id')); - $result = _civicrm_api3_get_options_from_params($params, FALSE, $Entity, 'get'); - $lowercase_entity = _civicrm_api_get_entity_name_from_camel($Entity); - $this->assertEquals($result['sort'], $lowercase_entity . '_id'); } /** -- 2.25.1