public function testUserList_HadOnlyUsers() { $model = new Api\Model\UserListModel(); $model->read(); foreach ($model->entries as $entry) { $this->assertTrue(array_key_exists("username", $entry), "Key 'username' not found " . print_r($entry, true)); } }
/** * * @return \Api\Model\UserListModel */ public static function listUsers() { $list = new \Api\Model\UserListModel(); $list->read(); // Default sort on username (currently needed to sort on Site Admin because MongoDB doesn't do case insensitive sorts) usort($list->entries, function ($a, $b) { $sortOn = 'username'; if (array_key_exists($sortOn, $a) && array_key_exists($sortOn, $b)) { return strtolower($a[$sortOn]) > strtolower($b[$sortOn]) ? 1 : -1; } else { return 0; } }); return $list; }