(NFC) tests/ - Update to pass new phpcs
authorTim Otten <totten@civicrm.org>
Fri, 5 Apr 2019 20:16:23 +0000 (13:16 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 5 Apr 2019 20:16:23 +0000 (13:16 -0700)
tests/phpunit/CRM/Export/BAO/ExportTest.php
tests/phpunit/CRM/Price/Form/FieldTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/E2E/Extern/RestTest.php

index f1341e1f18418675d47820d1ff85a651695d4715..00626abc0f83f253d9075508b71fde7de471ef55 100644 (file)
@@ -1724,14 +1724,14 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
     $selectedFields = $this->getAllSpecifiableParticipantReturnFields();
     foreach ($selectedFields as $index => $field) {
       if (substr($field[1], 0, 22) === 'componentPaymentField_') {
-        unset ($selectedFields[$index]);
+        unset($selectedFields[$index]);
       }
     }
 
     $expected = $this->getAllSpecifiableParticipantReturnFields();
     foreach ($expected as $index => $field) {
       if (substr($index, 0, 22) === 'componentPaymentField_') {
-        unset ($expected[$index]);
+        unset($expected[$index]);
       }
     }
 
index d1c13513bc0e13d8831b6c63ec4cb9301e41e18f..08ede64999d06de7313cf9aab25319a7c707bd8d 100644 (file)
@@ -1,85 +1,85 @@
-<?php\r
-\r
-class CRM_Price_Form_FieldTest extends CiviUnitTestCase {\r
-\r
-  protected $priceFieldValues;\r
-  protected $visibilityOptionsKeys;\r
-  protected $visibilityOptions;\r
-  protected $publicFieldParams;\r
-  protected $adminFieldParams;\r
-\r
-  public function setUp() {\r
-    parent::setUp();\r
-\r
-    $this->visibilityOptionsKeys = CRM_Price_BAO_PriceFieldValue::buildOptions('visibility_id', NULL, array(\r
-      'labelColumn' => 'name',\r
-      'flip' => TRUE,\r
-    ));\r
-\r
-    $this->publicFieldParams = $this->initializeFieldParameters(array(\r
-      'label' => 'Public Price Field',\r
-      'name' => 'public_price',\r
-      'visibility_id' => $this->visibilityOptionsKeys['public'],\r
-    ));\r
-\r
-    $this->adminFieldParams = $this->initializeFieldParameters(array(\r
-      'label' => 'Public Price Field',\r
-      'name' => 'public_price',\r
-      'visibility_id' => $this->visibilityOptionsKeys['admin'],\r
-    ));\r
-  }\r
-\r
-  public function testPublicFieldWithOnlyAdminOptionsIsNotAllowed() {\r
-    $this->publicFieldParams['option_label'][1] = 'Admin Price';\r
-    $this->publicFieldParams['option_amount'][1] = 10;\r
-    $this->publicFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['admin'];\r
-\r
-    $form = new CRM_Price_Form_Field();\r
-    $form->_action = CRM_Core_Action::ADD;\r
-    $files = array();\r
-\r
-    $validationResult = $form->formRule($this->publicFieldParams, $files, $form);\r
-    $this->assertType('array', $validationResult);\r
-    $this->assertTrue(array_key_exists('visibility_id', $validationResult));\r
-  }\r
-\r
-  public function testAdminFieldDoesNotAllowPublicOptions() {\r
-    $this->adminFieldParams['option_label'][1] = 'Admin Price';\r
-    $this->adminFieldParams['option_amount'][1] = 10;\r
-    $this->adminFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['public'];\r
-\r
-    $form = new CRM_Price_Form_Field();\r
-    $form->_action = CRM_Core_Action::ADD;\r
-    $files = array();\r
-\r
-    $validationResult = $form->formRule($this->adminFieldParams, $files, $form);\r
-    $this->assertType('array', $validationResult);\r
-    $this->assertTrue(array_key_exists('visibility_id', $validationResult));\r
-  }\r
-\r
-  private function initializeFieldParameters($params) {\r
-    $defaultParams = array(\r
-      'label' => 'Price Field',\r
-      'name' => CRM_Utils_String::titleToVar('Price Field'),\r
-      'html_type' => 'Select',\r
-      'is_display_amounts' => 1,\r
-      'weight' => 1,\r
-      'options_per_line' => 1,\r
-      'is_enter_qty' => 1,\r
-      'financial_type_id' => $this->getFinancialTypeId('Event Fee'),\r
-      'visibility_id' => $this->visibilityOptionsKeys['public'],\r
-    );\r
-\r
-    for ($index = 1; $index <= CRM_Price_Form_Field::NUM_OPTION; $index++) {\r
-      $defaultParams['option_label'][$index] = NULL;\r
-      $defaultParams['option_value'][$index] = NULL;\r
-      $defaultParams['option_name'][$index] = NULL;\r
-      $defaultParams['option_weight'][$index] = NULL;\r
-      $defaultParams['option_amount'][$index] = NULL;\r
-      $defaultParams['option_visibility_id'][$index] = NULL;\r
-    }\r
-\r
-    return array_merge($defaultParams, $params);\r
-  }\r
-\r
-}\r
+<?php
+
+class CRM_Price_Form_FieldTest extends CiviUnitTestCase {
+
+  protected $priceFieldValues;
+  protected $visibilityOptionsKeys;
+  protected $visibilityOptions;
+  protected $publicFieldParams;
+  protected $adminFieldParams;
+
+  public function setUp() {
+    parent::setUp();
+
+    $this->visibilityOptionsKeys = CRM_Price_BAO_PriceFieldValue::buildOptions('visibility_id', NULL, array(
+      'labelColumn' => 'name',
+      'flip' => TRUE,
+    ));
+
+    $this->publicFieldParams = $this->initializeFieldParameters(array(
+      'label' => 'Public Price Field',
+      'name' => 'public_price',
+      'visibility_id' => $this->visibilityOptionsKeys['public'],
+    ));
+
+    $this->adminFieldParams = $this->initializeFieldParameters(array(
+      'label' => 'Public Price Field',
+      'name' => 'public_price',
+      'visibility_id' => $this->visibilityOptionsKeys['admin'],
+    ));
+  }
+
+  public function testPublicFieldWithOnlyAdminOptionsIsNotAllowed() {
+    $this->publicFieldParams['option_label'][1] = 'Admin Price';
+    $this->publicFieldParams['option_amount'][1] = 10;
+    $this->publicFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['admin'];
+
+    $form = new CRM_Price_Form_Field();
+    $form->_action = CRM_Core_Action::ADD;
+    $files = array();
+
+    $validationResult = $form->formRule($this->publicFieldParams, $files, $form);
+    $this->assertType('array', $validationResult);
+    $this->assertTrue(array_key_exists('visibility_id', $validationResult));
+  }
+
+  public function testAdminFieldDoesNotAllowPublicOptions() {
+    $this->adminFieldParams['option_label'][1] = 'Admin Price';
+    $this->adminFieldParams['option_amount'][1] = 10;
+    $this->adminFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['public'];
+
+    $form = new CRM_Price_Form_Field();
+    $form->_action = CRM_Core_Action::ADD;
+    $files = array();
+
+    $validationResult = $form->formRule($this->adminFieldParams, $files, $form);
+    $this->assertType('array', $validationResult);
+    $this->assertTrue(array_key_exists('visibility_id', $validationResult));
+  }
+
+  private function initializeFieldParameters($params) {
+    $defaultParams = array(
+      'label' => 'Price Field',
+      'name' => CRM_Utils_String::titleToVar('Price Field'),
+      'html_type' => 'Select',
+      'is_display_amounts' => 1,
+      'weight' => 1,
+      'options_per_line' => 1,
+      'is_enter_qty' => 1,
+      'financial_type_id' => $this->getFinancialTypeId('Event Fee'),
+      'visibility_id' => $this->visibilityOptionsKeys['public'],
+    );
+
+    for ($index = 1; $index <= CRM_Price_Form_Field::NUM_OPTION; $index++) {
+      $defaultParams['option_label'][$index] = NULL;
+      $defaultParams['option_value'][$index] = NULL;
+      $defaultParams['option_name'][$index] = NULL;
+      $defaultParams['option_weight'][$index] = NULL;
+      $defaultParams['option_amount'][$index] = NULL;
+      $defaultParams['option_visibility_id'][$index] = NULL;
+    }
+
+    return array_merge($defaultParams, $params);
+  }
+
+}
index 08762b0ca6a9614b916207dc4d8f060af026b143..c3f62042e4d98b1cf6819d93f3ad5232794c81b8 100644 (file)
@@ -164,7 +164,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    * @param array $data
    * @param string $dataName
    */
-  public function __construct($name = NULL, array$data = array(), $dataName = '') {
+  public function __construct($name = NULL, array $data = array(), $dataName = '') {
     parent::__construct($name, $data, $dataName);
 
     // we need full error reporting
index 56e1b0e2d1d5d5638cacc224266fa14e41bc0214..0d9d963157144fabab97ca38015c06cdaffbf8ae 100644 (file)
@@ -292,10 +292,9 @@ class E2E_Extern_RestTest extends CiviEndToEndTestCase {
       'return' => 'id',
     ));
 
-    $this->old_api_keys[$adminContactId] = CRM_Core_DAO::singleValueQuery('SELECT api_key FROM civicrm_contact WHERE id = %1',
-      array(
-        1 => array($adminContactId, 'Positive'),
-      ));
+    $this->old_api_keys[$adminContactId] = CRM_Core_DAO::singleValueQuery('SELECT api_key FROM civicrm_contact WHERE id = %1', [
+      1 => [$adminContactId, 'Positive'],
+    ]);
 
     //$this->old_admin_api_key = civicrm_api3('Contact', 'get', array(
     //  'id' => $adminContactId,