Commit 511e9a21 authored by eileen's avatar eileen

[REF] Replace coalesce pattern with coalesce operator

This replaces the innstances in the test folder.
parent 849ac823
......@@ -8,22 +8,22 @@ class test_extension_manager_paymenttest extends CRM_Core_Payment {
public static $counts = array();
public function install() {
self::$counts['install'] = isset(self::$counts['install']) ? self::$counts['install'] : 0;
self::$counts['install'] = self::$counts['install'] ?? 0;
self::$counts['install'] = 1 + (int) self::$counts['install'];
}
public function uninstall() {
self::$counts['uninstall'] = isset(self::$counts['uninstall']) ? self::$counts['uninstall'] : 0;
self::$counts['uninstall'] = self::$counts['uninstall'] ?? 0;
self::$counts['uninstall'] = 1 + (int) self::$counts['uninstall'];
}
public function disable() {
self::$counts['disable'] = isset(self::$counts['disable']) ? self::$counts['disable'] : 0;
self::$counts['disable'] = self::$counts['disable'] ?? 0;
self::$counts['disable'] = 1 + (int) self::$counts['disable'];
}
public function enable() {
self::$counts['enable'] = isset(self::$counts['enable']) ? self::$counts['enable'] : 0;
self::$counts['enable'] = self::$counts['enable'] ?? 0;
self::$counts['enable'] = 1 + (int) self::$counts['enable'];
}
......@@ -38,7 +38,7 @@ class test_extension_manager_paymenttest extends CRM_Core_Payment {
* @return int
*/
public static function getCount($type) {
return isset(self::$counts[$type]) ? self::$counts[$type] : 0;
return self::$counts[$type] ?? 0;
}
}
......@@ -192,7 +192,7 @@ class ThemesTest extends \CiviUnitTestCase {
$map['bluemarine']['civicrm']['css/civicrm.css'] = ['http://example.com/blue/civicrm.css'];
$map['bluemarine']['test.extension.uitest']['files/foo.css'] = ['http://example.com/blue/foobar/foo.css'];
$map['aquamarine']['civicrm']['css/civicrm.css'] = ['http://example.com/aqua/civicrm.css'];
return isset($map[$themeKey][$cssExt][$cssFile]) ? $map[$themeKey][$cssExt][$cssFile] : Themes::PASSTHRU;
return $map[$themeKey][$cssExt][$cssFile] ?? Themes::PASSTHRU;
}
public function testGetAll() {
......
......@@ -1465,7 +1465,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
}
$updateParams = [
'id' => $entity['id'],
$field => isset($entity[$field]) ? $entity[$field] : NULL,
$field => $entity[$field] ?? NULL,
];
if (isset($updateParams['financial_type_id']) && in_array($entityName, ['Grant'])) {
//api has special handling on these 2 fields for backward compatibility reasons
......
......@@ -63,7 +63,7 @@ trait TestDataLoaderTrait {
* @return null|mixed
*/
protected function getReference($name) {
return isset($this->references[$name]) ? $this->references[$name] : NULL;
return $this->references[$name] ?? NULL;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment