Sidsector9 / ff-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FF Challenge

WPCS PHPUnit ESLint

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:

Chrome Firefox Safari
Latest Latest Latest

Post Page with shortcode (Twenty Twenty theme):

formidable local_hello-world_

Custom Options page:

formidable local_wp-admin_admin php_page=ff-challenge

About


Languages

Language:PHP 63.8%Language:JavaScript 30.3%Language:CSS 5.9%