FF Challenge
Acceptance criteria:
- Can be used when logged out or in
- Calls the http://api.strategy11.com/wp-json/challenge/v1/1 endpoint to get the data to return
- Which when called always returns the data, but regardless of when/how many times it is called should not request the data from our server more than 1 time per hour
- Create a shortcode for the frontend, that when loaded uses Javascript to contact your AJAX endpoint and display the data returned formatted into a table-like display
- Create a WP CLI command that can be used to force the refresh of this data the next time the AJAX endpoint is called
- Create a WordPress admin page which displays this data in the style of the admin page of the WordPress plugin Formidable Forms that includes the Formidable logo and header. Include a button to refresh the data
- Unit test to check if the request run multiple times an hour
- Unit test to check ifthe table showing the expected results
Installation notes:
This plugin relies on Redis Object Cache instead of Transient cache since Transient cache can expire before the expiration time.
Steps to install:
git clone https://github.com/Sidsector9/ff-challenge.git
cd ff-challenge
composer install
yarn install
yarn build
Features:
- Shortcode:
[ffc_challenge /]
renders the data from the API from the acceptance criteria in a table - CLI:
wp ff clear challenge-shortcode
will force the refresh of the data - Options Page:
Admin Dashboard > FF Challenge
displays the API data on a custom options page
PHPUnit Tests:
PHPUnit tests are written using 10up's WP_Mock since it is closer to performing the Unit Tests without loading the WordPress environment as in the case of WP_UnitTestCase
Browser Support:
Latest |
Latest |
Latest |