@mytechtoday/augment-extensions 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/augment-extensions/domain-rules/wordpress/README.md +163 -0
  2. package/augment-extensions/domain-rules/wordpress/module.json +32 -0
  3. package/augment-extensions/domain-rules/wordpress/rules/coding-standards.md +617 -0
  4. package/augment-extensions/domain-rules/wordpress/rules/directory-structure.md +270 -0
  5. package/augment-extensions/domain-rules/wordpress/rules/file-patterns.md +423 -0
  6. package/augment-extensions/domain-rules/wordpress/rules/gutenberg-blocks.md +493 -0
  7. package/augment-extensions/domain-rules/wordpress/rules/performance.md +568 -0
  8. package/augment-extensions/domain-rules/wordpress/rules/plugin-development.md +510 -0
  9. package/augment-extensions/domain-rules/wordpress/rules/project-detection.md +251 -0
  10. package/augment-extensions/domain-rules/wordpress/rules/rest-api.md +501 -0
  11. package/augment-extensions/domain-rules/wordpress/rules/security.md +564 -0
  12. package/augment-extensions/domain-rules/wordpress/rules/theme-development.md +388 -0
  13. package/augment-extensions/domain-rules/wordpress/rules/woocommerce.md +441 -0
  14. package/augment-extensions/domain-rules/wordpress-plugin/README.md +139 -0
  15. package/augment-extensions/domain-rules/wordpress-plugin/examples/ajax-plugin.md +1599 -0
  16. package/augment-extensions/domain-rules/wordpress-plugin/examples/custom-post-type-plugin.md +1727 -0
  17. package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block-plugin.md +428 -0
  18. package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block.md +422 -0
  19. package/augment-extensions/domain-rules/wordpress-plugin/examples/mvc-plugin.md +1623 -0
  20. package/augment-extensions/domain-rules/wordpress-plugin/examples/object-oriented-plugin.md +1343 -0
  21. package/augment-extensions/domain-rules/wordpress-plugin/examples/rest-endpoint.md +734 -0
  22. package/augment-extensions/domain-rules/wordpress-plugin/examples/settings-page-plugin.md +1350 -0
  23. package/augment-extensions/domain-rules/wordpress-plugin/examples/simple-procedural-plugin.md +503 -0
  24. package/augment-extensions/domain-rules/wordpress-plugin/examples/singleton-plugin.md +971 -0
  25. package/augment-extensions/domain-rules/wordpress-plugin/module.json +53 -0
  26. package/augment-extensions/domain-rules/wordpress-plugin/rules/activation-hooks.md +770 -0
  27. package/augment-extensions/domain-rules/wordpress-plugin/rules/admin-interface.md +874 -0
  28. package/augment-extensions/domain-rules/wordpress-plugin/rules/ajax-handlers.md +629 -0
  29. package/augment-extensions/domain-rules/wordpress-plugin/rules/asset-management.md +559 -0
  30. package/augment-extensions/domain-rules/wordpress-plugin/rules/context-providers.md +709 -0
  31. package/augment-extensions/domain-rules/wordpress-plugin/rules/cron-jobs.md +736 -0
  32. package/augment-extensions/domain-rules/wordpress-plugin/rules/database-management.md +1057 -0
  33. package/augment-extensions/domain-rules/wordpress-plugin/rules/documentation-standards.md +463 -0
  34. package/augment-extensions/domain-rules/wordpress-plugin/rules/frontend-functionality.md +478 -0
  35. package/augment-extensions/domain-rules/wordpress-plugin/rules/gutenberg-blocks.md +818 -0
  36. package/augment-extensions/domain-rules/wordpress-plugin/rules/internationalization.md +416 -0
  37. package/augment-extensions/domain-rules/wordpress-plugin/rules/migration.md +667 -0
  38. package/augment-extensions/domain-rules/wordpress-plugin/rules/performance-optimization.md +878 -0
  39. package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-architecture.md +693 -0
  40. package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-structure.md +352 -0
  41. package/augment-extensions/domain-rules/wordpress-plugin/rules/rest-api.md +818 -0
  42. package/augment-extensions/domain-rules/wordpress-plugin/rules/scaffolding-workflow.md +624 -0
  43. package/augment-extensions/domain-rules/wordpress-plugin/rules/security-best-practices.md +866 -0
  44. package/augment-extensions/domain-rules/wordpress-plugin/rules/testing-patterns.md +1165 -0
  45. package/augment-extensions/domain-rules/wordpress-plugin/rules/testing.md +414 -0
  46. package/augment-extensions/domain-rules/wordpress-plugin/rules/vscode-integration.md +751 -0
  47. package/augment-extensions/domain-rules/wordpress-plugin/rules/woocommerce-integration.md +949 -0
  48. package/augment-extensions/domain-rules/wordpress-plugin/rules/wordpress-org-submission.md +458 -0
  49. package/augment-extensions/examples/gutenberg-block-plugin/README.md +101 -0
  50. package/augment-extensions/examples/gutenberg-block-plugin/examples/testimonial-block.md +428 -0
  51. package/augment-extensions/examples/gutenberg-block-plugin/module.json +40 -0
  52. package/augment-extensions/examples/rest-api-plugin/README.md +98 -0
  53. package/augment-extensions/examples/rest-api-plugin/examples/task-manager-api.md +1299 -0
  54. package/augment-extensions/examples/rest-api-plugin/module.json +40 -0
  55. package/augment-extensions/examples/woocommerce-extension/README.md +98 -0
  56. package/augment-extensions/examples/woocommerce-extension/examples/product-customizer.md +763 -0
  57. package/augment-extensions/examples/woocommerce-extension/module.json +40 -0
  58. package/augment-extensions/workflows/wordpress-plugin/README.md +232 -0
  59. package/augment-extensions/workflows/wordpress-plugin/ai-prompts.md +839 -0
  60. package/augment-extensions/workflows/wordpress-plugin/bead-decomposition-patterns.md +854 -0
  61. package/augment-extensions/workflows/wordpress-plugin/examples/complete-plugin-example.md +540 -0
  62. package/augment-extensions/workflows/wordpress-plugin/examples/custom-post-type-example.md +1083 -0
  63. package/augment-extensions/workflows/wordpress-plugin/examples/feature-addition-workflow.md +669 -0
  64. package/augment-extensions/workflows/wordpress-plugin/examples/plugin-creation-workflow.md +597 -0
  65. package/augment-extensions/workflows/wordpress-plugin/examples/secure-form-handler-example.md +925 -0
  66. package/augment-extensions/workflows/wordpress-plugin/examples/security-audit-workflow.md +752 -0
  67. package/augment-extensions/workflows/wordpress-plugin/examples/wordpress-org-submission-workflow.md +773 -0
  68. package/augment-extensions/workflows/wordpress-plugin/module.json +49 -0
  69. package/augment-extensions/workflows/wordpress-plugin/rules/best-practices.md +942 -0
  70. package/augment-extensions/workflows/wordpress-plugin/rules/development-workflow.md +702 -0
  71. package/augment-extensions/workflows/wordpress-plugin/rules/submission-workflow.md +728 -0
  72. package/augment-extensions/workflows/wordpress-plugin/rules/testing-workflow.md +775 -0
  73. package/cli/dist/cli.js +5 -1
  74. package/cli/dist/cli.js.map +1 -1
  75. package/cli/dist/commands/show.d.ts.map +1 -1
  76. package/cli/dist/commands/show.js +41 -0
  77. package/cli/dist/commands/show.js.map +1 -1
  78. package/modules.md +52 -0
  79. package/package.json +1 -1
@@ -0,0 +1,414 @@
1
+ # Testing Guidelines for WordPress Plugins
2
+
3
+ ## Overview
4
+
5
+ This guide covers comprehensive testing strategies for WordPress plugins including automated testing with PHPUnit, Theme Check, Plugin Check, accessibility testing (WCAG 2.1), performance testing, and manual testing checklists.
6
+
7
+ ---
8
+
9
+ ## Automated Testing Tools
10
+
11
+ ### 1. Theme Check Plugin
12
+
13
+ **Purpose**: Validate WordPress coding standards and best practices
14
+
15
+ **Installation**:
16
+ ```bash
17
+ # Via WordPress admin
18
+ Plugins > Add New > Search "Theme Check"
19
+
20
+ # Or download from WordPress.org
21
+ https://wordpress.org/plugins/theme-check/
22
+ ```
23
+
24
+ **Usage**:
25
+ ```
26
+ 1. Install and activate Theme Check plugin
27
+ 2. Go to Appearance > Theme Check
28
+ 3. Select your theme
29
+ 4. Click "Check it!"
30
+ 5. Review warnings and errors
31
+ ```
32
+
33
+ **What it checks**:
34
+ - ✅ Required WordPress files
35
+ - ✅ Proper use of WordPress functions
36
+ - ✅ Deprecated function usage
37
+ - ✅ Security issues (escaping, sanitization)
38
+ - ✅ Translation readiness
39
+ - ✅ Licensing information
40
+
41
+ ---
42
+
43
+ ### 2. Plugin Check Plugin
44
+
45
+ **Purpose**: Validate plugin quality and WordPress.org submission requirements
46
+
47
+ **Installation**:
48
+ ```bash
49
+ # Via WP-CLI
50
+ wp plugin install plugin-check --activate
51
+
52
+ # Or via WordPress admin
53
+ Plugins > Add New > Search "Plugin Check"
54
+ ```
55
+
56
+ **Usage**:
57
+ ```bash
58
+ # Via WP-CLI
59
+ wp plugin check /path/to/your-plugin
60
+
61
+ # Or via WordPress admin
62
+ Tools > Plugin Check > Select plugin > Run Check
63
+ ```
64
+
65
+ **What it checks**:
66
+ - ✅ Plugin header information
67
+ - ✅ File structure and naming
68
+ - ✅ Security vulnerabilities
69
+ - ✅ Performance issues
70
+ - ✅ Accessibility compliance
71
+ - ✅ Internationalization
72
+ - ✅ WordPress coding standards
73
+
74
+ ---
75
+
76
+ ### 3. PHPUnit Tests
77
+
78
+ **Purpose**: Automated unit and integration testing
79
+
80
+ **Setup**:
81
+
82
+ ```bash
83
+ # Install PHPUnit via Composer
84
+ composer require --dev phpunit/phpunit
85
+
86
+ # Install WordPress test suite
87
+ bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
88
+
89
+ # Create phpunit.xml
90
+ ```
91
+
92
+ **File: `phpunit.xml`**
93
+
94
+ ```xml
95
+ <?xml version="1.0"?>
96
+ <phpunit
97
+ bootstrap="tests/bootstrap.php"
98
+ backupGlobals="false"
99
+ colors="true"
100
+ convertErrorsToExceptions="true"
101
+ convertNoticesToExceptions="true"
102
+ convertWarningsToExceptions="true"
103
+ >
104
+ <testsuites>
105
+ <testsuite name="unit">
106
+ <directory suffix=".php">./tests/unit/</directory>
107
+ </testsuite>
108
+ <testsuite name="integration">
109
+ <directory suffix=".php">./tests/integration/</directory>
110
+ </testsuite>
111
+ </testsuites>
112
+ <filter>
113
+ <whitelist>
114
+ <directory suffix=".php">./includes/</directory>
115
+ </whitelist>
116
+ </filter>
117
+ </phpunit>
118
+ ```
119
+
120
+ **Example Unit Test**:
121
+
122
+ ```php
123
+ <?php
124
+ class Test_Plugin_Functions extends WP_UnitTestCase {
125
+
126
+ public function test_sanitize_input() {
127
+ $input = '<script>alert("xss")</script>Test';
128
+ $expected = 'alert("xss")Test';
129
+ $result = my_plugin_sanitize($input);
130
+
131
+ $this->assertEquals($expected, $result);
132
+ }
133
+
134
+ public function test_validate_email() {
135
+ $this->assertTrue(my_plugin_validate_email('test@example.com'));
136
+ $this->assertFalse(my_plugin_validate_email('invalid-email'));
137
+ }
138
+
139
+ public function test_save_option() {
140
+ $option_name = 'my_plugin_option';
141
+ $option_value = 'test value';
142
+
143
+ my_plugin_save_option($option_name, $option_value);
144
+
145
+ $this->assertEquals($option_value, get_option($option_name));
146
+ }
147
+ }
148
+ ```
149
+
150
+ **Run Tests**:
151
+
152
+ ```bash
153
+ # Run all tests
154
+ vendor/bin/phpunit
155
+
156
+ # Run specific test suite
157
+ vendor/bin/phpunit --testsuite unit
158
+
159
+ # Run with coverage
160
+ vendor/bin/phpunit --coverage-html coverage/
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Accessibility Testing (WCAG 2.1)
166
+
167
+ ### Automated Accessibility Tools
168
+
169
+ **1. axe DevTools**
170
+ ```
171
+ 1. Install axe DevTools browser extension
172
+ 2. Open your plugin's admin pages
173
+ 3. Run axe scan
174
+ 4. Fix reported issues
175
+ ```
176
+
177
+ **2. WAVE (Web Accessibility Evaluation Tool)**
178
+ ```
179
+ 1. Visit https://wave.webaim.org/
180
+ 2. Enter your plugin page URL
181
+ 3. Review accessibility errors and warnings
182
+ ```
183
+
184
+ **3. WordPress Accessibility Checker**
185
+ ```bash
186
+ # Install via npm
187
+ npm install -g pa11y
188
+
189
+ # Run accessibility check
190
+ pa11y http://localhost/wp-admin/admin.php?page=your-plugin
191
+ ```
192
+
193
+ ### WCAG 2.1 Compliance Checklist
194
+
195
+ **Level A (Required)**:
196
+ - ✅ All images have alt text
197
+ - ✅ Form inputs have labels
198
+ - ✅ Keyboard navigation works
199
+ - ✅ Color contrast ratio ≥ 4.5:1 for normal text
200
+ - ✅ No keyboard traps
201
+ - ✅ Page has proper heading structure (h1, h2, h3)
202
+
203
+ **Level AA (Recommended)**:
204
+ - ✅ Color contrast ratio ≥ 7:1 for large text
205
+ - ✅ Focus indicators visible
206
+ - ✅ ARIA labels for complex widgets
207
+ - ✅ Error messages are descriptive
208
+ - ✅ Time limits can be extended
209
+
210
+ **Testing Steps**:
211
+ ```
212
+ 1. Navigate entire plugin using only keyboard (Tab, Enter, Esc)
213
+ 2. Test with screen reader (NVDA, JAWS, VoiceOver)
214
+ 3. Check color contrast with browser tools
215
+ 4. Verify all interactive elements have focus states
216
+ 5. Test forms with validation errors
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Performance Testing
222
+
223
+ ### 1. Query Monitor Plugin
224
+
225
+ **Installation**:
226
+ ```bash
227
+ wp plugin install query-monitor --activate
228
+ ```
229
+
230
+ **What to check**:
231
+ - ✅ Database queries (< 50 per page load)
232
+ - ✅ Query execution time (< 0.05s per query)
233
+ - ✅ HTTP requests (minimize external calls)
234
+ - ✅ PHP errors and warnings
235
+ - ✅ Hook execution time
236
+
237
+ **Usage**:
238
+ ```
239
+ 1. Activate Query Monitor
240
+ 2. Use your plugin features
241
+ 3. Check admin toolbar for Query Monitor menu
242
+ 4. Review Queries, HTTP, Hooks tabs
243
+ 5. Optimize slow queries and hooks
244
+ ```
245
+
246
+ ---
247
+
248
+ ### 2. P3 (Plugin Performance Profiler)
249
+
250
+ **Installation**:
251
+ ```bash
252
+ wp plugin install p3-profiler --activate
253
+ ```
254
+
255
+ **Usage**:
256
+ ```
257
+ 1. Go to Tools > P3 Plugin Profiler
258
+ 2. Click "Start Scan"
259
+ 3. Browse your site normally
260
+ 4. Stop scan and view results
261
+ 5. Identify performance bottlenecks
262
+ ```
263
+
264
+ ---
265
+
266
+ ### 3. Load Testing
267
+
268
+ **Using Apache Bench**:
269
+ ```bash
270
+ # Test 100 requests with 10 concurrent
271
+ ab -n 100 -c 10 http://localhost/wp-admin/admin.php?page=your-plugin
272
+ ```
273
+
274
+ **Using WP-CLI**:
275
+ ```bash
276
+ # Profile plugin activation
277
+ wp profile stage --all
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Manual Testing Checklist
283
+
284
+ ### Installation & Activation
285
+ - [ ] Plugin installs without errors
286
+ - [ ] Plugin activates successfully
287
+ - [ ] No PHP errors in debug.log
288
+ - [ ] Database tables created (if applicable)
289
+ - [ ] Default options set correctly
290
+ - [ ] Admin notices display properly
291
+
292
+ ### Functionality Testing
293
+ - [ ] All features work as expected
294
+ - [ ] Forms submit correctly
295
+ - [ ] AJAX requests complete successfully
296
+ - [ ] Shortcodes render properly
297
+ - [ ] Widgets display correctly
298
+ - [ ] Custom post types appear
299
+ - [ ] Meta boxes save data
300
+
301
+ ### Security Testing
302
+ - [ ] Nonce verification on all forms
303
+ - [ ] Capability checks on admin pages
304
+ - [ ] Input sanitization working
305
+ - [ ] Output escaping working
306
+ - [ ] SQL queries use prepared statements
307
+ - [ ] File uploads validated
308
+ - [ ] CSRF protection in place
309
+
310
+ ### Compatibility Testing
311
+ - [ ] Works with latest WordPress version
312
+ - [ ] Works with PHP 7.4, 8.0, 8.1, 8.2
313
+ - [ ] Compatible with popular themes
314
+ - [ ] Compatible with popular plugins
315
+ - [ ] Multisite compatible (if applicable)
316
+ - [ ] Works in different browsers
317
+
318
+ ### Deactivation & Uninstall
319
+ - [ ] Plugin deactivates cleanly
320
+ - [ ] No errors on deactivation
321
+ - [ ] Uninstall removes all data (if configured)
322
+ - [ ] Database tables removed (if applicable)
323
+ - [ ] Options deleted (if configured)
324
+
325
+ ### Accessibility Testing
326
+ - [ ] Keyboard navigation works
327
+ - [ ] Screen reader compatible
328
+ - [ ] Color contrast sufficient
329
+ - [ ] Focus indicators visible
330
+ - [ ] ARIA labels present
331
+ - [ ] Forms have proper labels
332
+
333
+ ### Performance Testing
334
+ - [ ] Page load time < 3 seconds
335
+ - [ ] Database queries optimized
336
+ - [ ] Assets minified and concatenated
337
+ - [ ] Images optimized
338
+ - [ ] Caching implemented
339
+ - [ ] No memory leaks
340
+
341
+ ---
342
+
343
+ ## Continuous Integration (CI)
344
+
345
+ ### GitHub Actions Example
346
+
347
+ **File: `.github/workflows/test.yml`**
348
+
349
+ ```yaml
350
+ name: Test Plugin
351
+
352
+ on: [push, pull_request]
353
+
354
+ jobs:
355
+ test:
356
+ runs-on: ubuntu-latest
357
+
358
+ strategy:
359
+ matrix:
360
+ php: ['7.4', '8.0', '8.1', '8.2']
361
+ wordpress: ['6.0', '6.4', 'latest']
362
+
363
+ steps:
364
+ - uses: actions/checkout@v3
365
+
366
+ - name: Setup PHP
367
+ uses: shivammathur/setup-php@v2
368
+ with:
369
+ php-version: ${{ matrix.php }}
370
+ extensions: mysqli
371
+ coverage: xdebug
372
+
373
+ - name: Install dependencies
374
+ run: composer install --prefer-dist --no-progress
375
+
376
+ - name: Install WordPress Test Suite
377
+ run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }}
378
+
379
+ - name: Run PHPUnit tests
380
+ run: vendor/bin/phpunit --coverage-clover coverage.xml
381
+
382
+ - name: Run Plugin Check
383
+ run: wp plugin check .
384
+
385
+ - name: Upload coverage
386
+ uses: codecov/codecov-action@v3
387
+ with:
388
+ files: ./coverage.xml
389
+ ```
390
+
391
+ ---
392
+
393
+ ## Best Practices
394
+
395
+ ### DO
396
+ ✅ Write tests before implementing features (TDD)
397
+ ✅ Test on multiple PHP versions
398
+ ✅ Test on multiple WordPress versions
399
+ ✅ Use automated testing in CI/CD
400
+ ✅ Test with real user scenarios
401
+ ✅ Check accessibility with screen readers
402
+ ✅ Profile performance regularly
403
+ ✅ Test multisite if applicable
404
+ ✅ Validate with Plugin Check before release
405
+
406
+ ### DON'T
407
+ ❌ Skip writing tests
408
+ ❌ Test only on latest versions
409
+ ❌ Ignore accessibility
410
+ ❌ Deploy without performance testing
411
+ ❌ Skip security testing
412
+ ❌ Forget to test deactivation/uninstall
413
+ ❌ Ignore PHP errors and warnings
414
+ ❌ Skip cross-browser testing