1. 17 Apr, 2019 1 commit
  2. 15 Apr, 2019 1 commit
  3. 14 Apr, 2019 9 commits
  4. 13 Apr, 2019 9 commits
    • totten's avatar
      (#873) civi.api.prepare - Allow dynamic wrappers · 9abe1c3b
      totten authored
      Allow extensions to dynamically wrap an API. There are some existing mechanisms which sort-of allow wrapping, but
      this enables additional use-cases.
      There are a few techniques for wrapping or overriding an API, but none is suitable to my current use-case. Limitations:
      * `hook_civicrm_apiWrappers` - This allows registering things before and after the API call, but it does not allow
         changing the underlying API call.
      * `civi.api.{authorize,prepare,respond}` events - Same as above. These are a bit more nuanced/fine-grained, but still does not allow changing
      * `civi.api.resolve` event with `AdhocProvider` - This allows you to swap an API completely, but it doesn't allow you
        to delegate back to the original API call (if you've got nothing to add).
      One may subscribe to `civi.api.prepare` and then call the `wrapApi()` helper:
      function onPrepare($event) {
        if ($event->getApiRequestSig() === '3.widget.frobnicate') {
          $event->wrapApi(function($apiRequest, $continue){
            echo "Hello\n";
            $r = $continue($apiRequest);
            echo "Goodbye\n";
            return $r;
      Key characteristics:
      * The wrapper only applies if you register it specifically for the given API call.
      * The wrapper allows you to defer to the original implementation (`$continue`).
      * The wrapper allows you to perform logic before and after.
      * The wrapper allows you to *conditionally* replace -- you might call `$continue` or something entirely different.
      The style here is more event-oriented, but you can see the same concept in OOP systems, such as PHP's function-override notation.
      This would be analogous:
      class MyChild extends MyParent {
        function frobnicate($arg1) {
          echo "Hello\n";
          $r = parent::frobnicate($arg1);
          echo "Goodbye\n";
          return $r;
    • Seamus Lee's avatar
      Merge pull request #14044 from totten/master-test-trait-2 · 8a0e9777
      Seamus Lee authored
      (REF; #873) CiviUnitTestCase - Extract traits to facilitate extension testing
    • totten's avatar
      (NFC) SchemaStructure.php - Fix up mismatch between stored+generated code · 3eb2aab1
      totten authored
      The class `CRM_Core_I18n_SchemaStructure` is autogenerated via GenCode, and it is also commited to git.
      The two forms don't match because of the recent code-style cleanup.
      After running GenCode, there appears to be uncommitted changes in `CRM_Core_I18n_SchemaStructure`.
      The changes indicate a reversion in code-style (e.g. `null` vs `NULL`; some whitespace).
      GenCode produces output which matches the recent cleanup.
      Fixing `null` / `NULL` was easy. However, the whitespace mismatch was more subtle -- because the
      `PHP_Beautifier` was messing it up. To resolve, I disabled `PHP_Beautifier` for this file, and fixed
      the underlying templates to generate well-formed code.
      The output of the process matches the existing code; therefore, the change
      have no functional impact (NFC).  You can see this by running `setup.sh` and
      checking the `git status`.
    • totten's avatar
    • totten's avatar
      Move helpers from CiviUnitTestCase to MailingTestTrait · 71f1227b
      totten authored
      * `createMailing(...)`
      * `deleteMailing(...)`
    • totten's avatar
      Move helpers from CiviUnitTestCase to DbTestTrait · 8c68b9c9
      totten authored
      * `assertDBState(...)`
      * `assertDBNotNull(...)`
      * `assertDBNull(...)`
      * `assertDBRowNotExist(...)`
      * `assertDBRowExist(...)`
      * `assertDBCompareValue(...)`
      * `assertDBCompareValues(...)`
      * `assertDBQuery(...)`
    • totten's avatar
      Move helpers from CiviUnitTestCase to GenericAssertionsTrait · 1426d341
      totten authored
      * `assertType(...)`
      * `assertTreeEquals(...)`
      * `assertApproxEquals(...)`
      * `assertAttributesEquals(...)`
      * `assertArrayKeyExists(...)`
      * `assertArrayValueNotNull(...)`
      * `assertArrayValuesEqual(...)`
    • totten's avatar
      Move helpers from CiviUnitTestCase to ContactTestTrait · a23e13eb
      totten authored
      * `createLoggedInUser(...)`
      * `organizationCreate(...)`
      * `individualCreate(...)`
      * `householdCreate(...)`
      * `sampleContact(...)`
      * `_contactCreate(...)`
      * `contactDelete(...)`
      * `groupContactCreate(...)`
      * `groupCreate(...)`
      * `groupDelete(...)`
    • eileen's avatar
      Merge pull request #14041 from colemanw/fieldTitles · 23f407d6
      eileen authored
      Add pseudoconstant to UFField dao
  5. 12 Apr, 2019 7 commits
  6. 11 Apr, 2019 13 commits