Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191
This commit is contained in:
42
test-class-loading.sh
Normal file
42
test-class-loading.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Simple test for class loading validation
|
||||
|
||||
echo "Testing class loading validation..."
|
||||
|
||||
# Create a simple test file with class loading issues
|
||||
cat > /tmp/test-class-loading.php << 'EOF'
|
||||
<?php
|
||||
// Test file with class loading issues
|
||||
|
||||
// Admin hooks without admin class loading
|
||||
add_action('admin_menu', array('Test_Admin', 'add_menu'));
|
||||
|
||||
// Frontend hooks without frontend class loading
|
||||
add_action('wp_enqueue_scripts', array('Test_Frontend', 'enqueue'));
|
||||
|
||||
// Static method calls on potentially unloaded classes
|
||||
$result = Test_Admin::some_method();
|
||||
|
||||
// Class instantiation without proper loading
|
||||
$admin = new Test_Admin();
|
||||
EOF
|
||||
|
||||
echo "Created test file with class loading issues"
|
||||
|
||||
# Test the pattern matching
|
||||
echo "Testing regex patterns..."
|
||||
|
||||
# Test admin class loading detection
|
||||
if grep -qE "add_action\s*\(\s*['\"]admin_menu" /tmp/test-class-loading.php; then
|
||||
echo "✓ Admin hook detection working"
|
||||
fi
|
||||
|
||||
if grep -qE "(Admin|admin)" /tmp/test-class-loading.php; then
|
||||
echo "✓ Admin class reference detection working"
|
||||
fi
|
||||
|
||||
if ! grep -B10 "add_action.*admin_menu" /tmp/test-class-loading.php | grep -qE "(require|include).*Admin"; then
|
||||
echo "✓ Admin class loading validation working - detected missing load"
|
||||
fi
|
||||
|
||||
echo "Class loading validation test completed"
|
||||
Reference in New Issue
Block a user