stream icon indicating copy to clipboard operation
stream copied to clipboard

GravityForms connector test implemented

Open kidunot89 opened this issue 4 years ago • 3 comments

Partially fixes #1093

Summary checklist

  • [x] gform_after_save_form callback test implemented and passing.
  • [x] gform_delete_lead callback test implemented and passing.
  • [x] gform_pre_confirmation_save callback test implemented and passing.
  • [x] gform_pre_notification_save callback test implemented and passing.
  • [x] gform_pre_notification_deleted callback test implemented and passing.
  • [x] gform_pre_confirmation_deleted callback test implemented and passing.
  • [x] gform_confirmation_status callback test implemented and passing.
  • [x] gform_notification_status callback test implemented and passing.
  • [x] check function test implemented and passing.
  • [x] gform_post_note_added callback test implemented and passing.
  • [x] gform_pre_note_deleted callback test implemented and passing.
  • [x] gform_update_status callback test implemented and passing.
  • [x] gform_update_is_read callback test implemented and passing.
  • [x] gform_update_is_starred callback test implemented and passing.
  • [x] log_form_action function test implemented and passing.
  • [x] gform_post_export_entries callback test implemented and passing.
  • [x] gform_forms_post_import callback test implemented and passing.
  • [x] gform_export_separator callback refactored. It's now the gform_export_form callback and has been tested.
  • No test was written for thegform_export_options callback. Further inspection is needed to determine it's relevance.

kidunot89 avatar Jul 10 '20 16:07 kidunot89

@kasparsd I'm not sure about leaving the plugin out, since the tests relies on it.

kidunot89 avatar Aug 18 '20 19:08 kidunot89

@kidunot89 and @kasparsd In order to add the plugin it would need to be done in a way that is progressive and legal. It should not fail a build if the plugin is missing, so tests should only run if installed and active, and while we can install it with Composer I'm not sure if we can gracefully fail.

At any rate the minimum changes are that we need to add this object to the repositories array.

{
  "type": "package",
  "package": {
    "name": "gravityforms/gravityforms",
    "version": "2.4.21.3",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://www.gravityhelp.com/wp-content/plugins/gravitymanager/api.php?op=get_plugin&slug=gravityforms&key={%GRAVITYFORMS_KEY}"
    },
    "require": {
      "composer/installers": "^1.4",
      "gotoandplay/gravityforms-composer-installer": "^2.3"
    }
  }
}

Also, we will need to add "gravityforms/gravityforms": "2.4.21.3" to require-dev and find a way to fail gracefully if the environment variable for the key it either missing or invalid. Locally you would also need to create a .env file and add GRAVITYFORMS_KEY=YOUR_SECRET_KEY and for the build to pass we can add the elite key we use for XWP projects to Travis CI.

There are really only two hurdles:

  1. Make tests run with/without plugin
  2. Degrade gracefully in Composer

derekherman avatar Nov 14 '20 00:11 derekherman

@kasparsd @ivankruchkoff The GravityForms package has been updated as @derekherman suggested, and I've added the GRAVITYFORMS_KEY as a secret in Travis-CI. If either of your reviews approve this should finally be all ready for merging.

kidunot89 avatar Nov 25 '20 17:11 kidunot89