Testing

Ensure your plugin works correctly before deployment.

Manual Testing Steps

1. Copy Plugin to Plugins Folder

cp -r my-plugin /var/www/pteroca/plugins/

2. Scan for Plugin

docker exec pteroca_web_dev php bin/console pteroca:plugin:scan

3. Check Plugin Info

docker exec pteroca_web_dev php bin/console pteroca:plugin:info my-plugin

Expected output:

Plugin: my-plugin
Display Name: My Awesome Plugin
Version: 1.0.0
Author: Your Name <[email protected]>
Status: DISCOVERED
Capabilities: routes, entities, migrations, ui

4. Run Security Scan

Look for:

  • ✅ No dangerous functions

  • ✅ No eval() usage

  • ✅ No shell_exec() usage

  • ✅ Secure file operations

5. Enable Plugin

Watch for errors during:

  • Bootstrap initialization

  • Migration execution

  • Asset publishing

  • Service registration

6. Check Health

Verify:

  • ✅ All capabilities working

  • ✅ Database tables created

  • ✅ Services registered

  • ✅ Routes loaded

7. Test Functionality

In Browser:

  1. Access plugin routes: https://your-domain.com/plugins/my-plugin/

  2. Check widgets appear on dashboard

  3. Verify admin menu items

  4. Test server tabs (if applicable)

  5. Check settings configuration page

  6. Test forms and CRUD operations

Via CLI:

8. Check Logs for Errors

Look for:

  • PHP errors

  • SQL errors

  • Missing files

  • Permission issues

9. Disable and Re-enable

Verify:

  • Cleanup runs properly

  • Re-initialization works

  • Data persists

  • Settings remain

Debugging

Check Logs

Verify Autoloading

Check Routes

Verify Migrations

Test Database Queries

Common Issues

Class Not Found

Problem: Class 'Plugins\MyPlugin\Controller\MyController' not found

Solutions:

  1. Check namespace matches directory structure (PSR-4)

  2. Clear cache: php bin/console cache:clear

  3. Verify composer autoloading (if using composer.json)

Routes Not Working

Problem: 404 errors when accessing plugin routes

Solutions:

  1. Check route naming convention: plugin_{name}_{action}

  2. Verify controller is tagged: controller.service_arguments

  3. Clear cache

  4. Check routes loaded: debug:router | grep plugin_my_plugin

Assets Not Loading

Problem: CSS/JS files return 404

Solutions:

  1. Republish assets:

  2. Check file permissions

  3. Verify asset paths in plugin.json

  4. Check symlinks in public/assets/plugins/my-plugin/

Database Errors

Problem: SQL syntax errors or table doesn't exist

Solutions:

  1. Check migration SQL syntax

  2. Verify table names use plg_ prefix

  3. Test migration manually:

  4. Check database user permissions

Widget Not Appearing

Problem: Widget doesn't show on dashboard

Solutions:

  1. Verify widget is tagged: tags: ['widget']

  2. Check isVisible() returns true

  3. Check context matches: WidgetContext::DASHBOARD

  4. Clear cache

  5. Check for JavaScript errors in browser console

Settings Not Saving

Problem: Plugin settings don't persist

Solutions:

  1. Verify settings context: plugin:my-plugin

  2. Check config_schema in plugin.json

  3. Verify database table setting exists

  4. Check user permissions

Browser Testing

Check JavaScript Console

  1. Open browser DevTools (F12)

  2. Go to Console tab

  3. Look for errors when:

    • Loading pages

    • Clicking buttons

    • Submitting forms

Check Network Tab

  1. Go to Network tab in DevTools

  2. Verify:

    • Assets load successfully (200 status)

    • API calls return correct responses

    • No CORS errors

    • Proper content types

Test in Multiple Browsers

  • Chrome/Chromium

  • Firefox

  • Safari (if applicable)

  • Edge

Test Responsive Design

  • Desktop (1920x1080)

  • Tablet (768x1024)

  • Mobile (375x667)

Performance Testing

Check Plugin Load Time

Monitor Memory Usage

Profile Database Queries

Enable Symfony profiler in development and check query count/time.

Automated Testing (Optional)

Unit Tests

Integration Tests

Run Tests

Checklist Before Release

Last updated