Description:
This issue focuses on implementing unit tests to verify the functionality of the Shortcode Visualizer and Dynamic Loader Plugin. The plugin allows users to create, edit, and dynamically load GPT-generated shortcodes from the database into WordPress.
The tests will cover the following areas:
Ensuring the required database table is created on activation.
Verifying that shortcodes can be inserted into and retrieved from the database.
Checking the dynamic registration and rendering of the shortcodes.
Testing the ability to edit and update existing shortcodes.
Simulating user input form submissions and ensuring proper input handling.
Ensuring the plugin follows security best practices by sanitizing and escaping inputs to prevent SQL injection and XSS attacks.
Acceptance Criteria:
Database Creation:
The wp_shortcode_visualizer table is successfully created upon plugin activation.
Shortcode Insertion and Retrieval:
Shortcodes can be inserted into the database and retrieved for rendering.
Shortcodes are correctly displayed when used within WordPress content.
Dynamic Shortcode Registration:
Shortcodes stored in the database are dynamically registered using add_shortcode().
Shortcodes render without errors when placed in posts or pages.
Shortcode Editing:
Users can edit existing shortcodes from the admin panel, and changes are reflected in the database.
Edited shortcodes render correctly after modification.
Form Submission Handling:
The form processes user-submitted shortcode names and content correctly, storing them securely in the database.
The form renders properly on the front end.
Security Testing:
Inputs are properly sanitized using sanitize_text_field() and wp_kses_post() to prevent SQL injection and XSS attacks.
Tests confirm secure input handling in the plugin’s forms and database operations.
Description: This issue focuses on implementing unit tests to verify the functionality of the Shortcode Visualizer and Dynamic Loader Plugin. The plugin allows users to create, edit, and dynamically load GPT-generated shortcodes from the database into WordPress.
The tests will cover the following areas:
Ensuring the required database table is created on activation. Verifying that shortcodes can be inserted into and retrieved from the database. Checking the dynamic registration and rendering of the shortcodes. Testing the ability to edit and update existing shortcodes. Simulating user input form submissions and ensuring proper input handling. Ensuring the plugin follows security best practices by sanitizing and escaping inputs to prevent SQL injection and XSS attacks. Acceptance Criteria: Database Creation:
The wp_shortcode_visualizer table is successfully created upon plugin activation. Shortcode Insertion and Retrieval:
Shortcodes can be inserted into the database and retrieved for rendering. Shortcodes are correctly displayed when used within WordPress content. Dynamic Shortcode Registration:
Shortcodes stored in the database are dynamically registered using add_shortcode(). Shortcodes render without errors when placed in posts or pages. Shortcode Editing:
Users can edit existing shortcodes from the admin panel, and changes are reflected in the database. Edited shortcodes render correctly after modification. Form Submission Handling:
The form processes user-submitted shortcode names and content correctly, storing them securely in the database. The form renders properly on the front end. Security Testing:
Inputs are properly sanitized using sanitize_text_field() and wp_kses_post() to prevent SQL injection and XSS attacks. Tests confirm secure input handling in the plugin’s forms and database operations.