Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACF connector test implemented and ACF v5.x support added #1118

Merged
merged 1 commit into from
Aug 14, 2020

Conversation

kidunot89
Copy link
Contributor

@kidunot89 kidunot89 commented Jun 23, 2020

Partially fixes #1093
Fixes and closes #1122

Summary

  • Updates the ACF connector class to work with the changes made in ACF v5+
  • Adds tests for ACF v5+ connector logic.
  • Adds wpackagist repository and wpackagist-plugin/advanced-custom-fields dev dependency to the composer.json.
  • Updates tests bootstrap file to activate plugins defined in the PHPUnit const WP_TEST_ACTIVATED_PLUGINS

@kidunot89 kidunot89 added the tooling Development and deployment tooling improvements label Jun 23, 2020
@kidunot89 kidunot89 self-assigned this Jun 25, 2020
composer.json Outdated Show resolved Hide resolved
@kopepasah
Copy link
Contributor

@kidunot89 my only concern here is requiring the ACF plugin from Composer for development. If we were to follow this same practice, we could end up with a ton of WordPress plugins we are adding the the Composer config, which are not really required for development, but rather for testing. Installing of these plugins for the PHPUnit tests may better be served in some other scripted process for testing, but would like to hear your thoughts on why this method is prefered.

@kidunot89
Copy link
Contributor Author

kidunot89 commented Jun 30, 2020

@kopepasah Yes, My plan is to add all the plugins, supported by stream through connectors, to the dev dependencies, and writing an integration test for each connector. My reasoning is simply that it's the best option for testing the connectors while adding some future-proofing when those plugins are updated with breaking changes.

@kidunot89 kidunot89 requested a review from kopepasah June 30, 2020 23:05
@kasparsd
Copy link
Contributor

kasparsd commented Jul 1, 2020

@kidunot89 I suspect the failing unit tests are caused by wp-dev-lib copying over the project source files to a different place for the actual test run:

https://github.com/xwp/wp-dev-lib/blob/420f1bac828e105a19a904cab97d042891d4b84e/scripts/check-diff.sh#L757-L765

So none of the dependencies (plugins) are moved over to the same wp-content/plugins directory. This is a great example of the many assumptions wp-dev-lib makes about the project structure.

I guess at this point we can switch to using the Docker test environment on Travis too. There are ways to cache the Docker images once they're built so we should be fine.

@kidunot89 kidunot89 changed the title ACF connector updated and tested ACF connector test implemented and ACF v5.x support added Jul 2, 2020
@kidunot89
Copy link
Contributor Author

kidunot89 commented Jul 2, 2020

@kasparsd I don't believe that to be the case due to the fact that the same configurations are being used in the bbPress connector PR and CI is passing 👉 #1120

I'm rebasing the branch to and the latest develop branch commit and repushing to see if that makes a difference here.

@kasparsd
Copy link
Contributor

kasparsd commented Jul 2, 2020

@kidunot89 Unfortunately this is another issue with wp-dev-lib -- those tests are passing because it didn't even run the tests https://travis-ci.com/github/xwp/stream/jobs/355627134#L490 -- the source "$DEV_LIB_PATH/travis.script.sh" command failed silently...

@kidunot89 kidunot89 force-pushed the tests/connectors branch 2 times, most recently from 78b4be1 to 90a4f06 Compare July 11, 2020 16:20
@kopepasah
Copy link
Contributor

@kidunot89 just a quick question, regarding ACF v5. Do we need to perform any version checks for backwards compatibility or does the functionality simply not exist pre-v5?

@kidunot89
Copy link
Contributor Author

@kopepasah Pre-v5 functionality exists, it's just not tested, or updated.

connectors/class-connector-acf.php Outdated Show resolved Hide resolved
connectors/class-connector-acf.php Outdated Show resolved Hide resolved
tests/tests/connectors/test-class-connector-acf.php Outdated Show resolved Hide resolved
@kopepasah
Copy link
Contributor

@kopepasah Pre-v5 functionality exists, it's just not tested, or updated.

Thanks for that information! It is difficult to tell, just by reviewing, which parts are pre-v5 and remain backwards compatible, but as long as you are aware, then that can be resolved when testing the changes.

I added my review and requested just a few changes.

@kidunot89
Copy link
Contributor Author

kidunot89 commented Jul 21, 2020

@kopepasah I'll add notes in the doc blocks for the pre ACF-v5 callbacks.

@kasparsd
Copy link
Contributor

This looks good @kidunot89! Feel free to merge if there is nothing to add.

@kasparsd kasparsd merged commit 11612bf into xwp:develop Aug 14, 2020
@kidunot89 kidunot89 deleted the tests/connectors branch August 14, 2020 15:20
@kasparsd kasparsd mentioned this pull request Oct 14, 2020
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Development and deployment tooling improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for Advanced Custom Fields (ACF) version 5 Improve Test Coverage
3 participants