@@ -24,13 +24,12 @@ jobs:
2424 node-version-file : ' .nvmrc'
2525 cache : ' npm'
2626
27- - name : Install Node.js dependencies
27+ - name : Install
2828 run : npm ci
2929
30- - name : Start WordPress environment
30+ - name : Setup Environment
3131 run : |
3232 npm run setup
33- sleep 10
3433
3534 - name : Wait for WordPress to be ready
3635 run : |
4039 run : |
4140 npm run wp-env run cli -- -- wp plugin activate phpdoc-parser posts-to-posts
4241
43- - name : Debug plugin and command availability
44- run : |
45- echo "Checking plugin status..."
46- npm run wp-env run cli -- -- wp plugin list
47- echo "Checking available commands..."
48- npm run wp-env run cli -- -- wp help
49- echo "Checking if parser command exists..."
50- npm run wp-env run cli -- -- wp help parser
51-
5242 - name : Run sample import (subset of files)
5343 run : |
5444 # Import a small subset of WordPress core files for testing
@@ -59,23 +49,22 @@ jobs:
5949 # Check that functions were imported
6050 FUNCTION_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-function --format=count | tail -1)
6151 echo "Functions imported: $FUNCTION_COUNT"
62-
52+
6353 if [ "$FUNCTION_COUNT" -lt 50 ]; then
6454 echo "ERROR: Expected at least 50 functions, got $FUNCTION_COUNT"
6555 exit 1
6656 fi
67-
68- # Check that classes were imported
69- CLASS_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-class --format=count | tail -1)
70- echo "Classes imported: $CLASS_COUNT"
71-
72- # Check that hooks were imported
73- HOOK_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-hook --format=count | tail -1)
74- echo "Hooks imported: $HOOK_COUNT"
75-
76- # Check that methods were imported
77- METHOD_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-method --format=count | tail -1)
78- echo "Methods imported: $METHOD_COUNT"
57+
58+ - name : Verify taxonomy terms
59+ run : |
60+ # Check that taxonomy terms are properly assigned
61+ FILE_TERMS=$(npm run wp-env run cli -- -- wp term list wp-parser-source-file --format=count | tail -1)
62+ echo "File taxonomy terms: $FILE_TERMS"
63+
64+ if [ "$FILE_TERMS" -eq 0 ]; then
65+ echo "ERROR: No file taxonomy terms found"
66+ exit 1
67+ fi
7968
8069 - name : Test parser command with error detection
8170 run : |
@@ -84,47 +73,10 @@ jobs:
8473 echo "ERROR: Parser command failed"
8574 exit 1
8675 fi
87-
76+
8877 # Check for PHP warnings or errors in output
8978 if grep -i "warning\|error\|fatal" import_output.log | grep -v "WP_CLI"; then
9079 echo "ERROR: PHP warnings or errors detected in parser output"
9180 cat import_output.log
9281 exit 1
9382 fi
94-
95- echo "✓ Parser completed without PHP warnings or errors"
96-
97- - name : Verify specific function exists
98- run : |
99- # Test that a well-known WordPress function was parsed correctly from functions.php
100- FUNCTION_EXISTS=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-function --s=wp_date --format=count | tail -1)
101- if [ "$FUNCTION_EXISTS" -eq 0 ]; then
102- echo "ERROR: wp_date function not found in parsed data"
103- exit 1
104- fi
105- echo "✓ wp_date function successfully parsed"
106-
107- - name : Test database integrity
108- run : |
109- # Check that taxonomies are properly assigned
110- FILE_TERMS=$(npm run wp-env run cli -- -- wp term list wp-parser-source-file --format=count | tail -1)
111- echo "File taxonomy terms: $FILE_TERMS"
112-
113- if [ "$FILE_TERMS" -eq 0 ]; then
114- echo "ERROR: No file taxonomy terms found"
115- exit 1
116- fi
117-
118- echo "✓ Database integrity checks passed"
119-
120- - name : Test WP-CLI functionality
121- run : |
122- # Test that WP-CLI is working with the parser
123- npm run wp-env run cli -- -- wp parser --help | grep -q "create"
124- echo "✓ WP-CLI parser command available"
125-
126- - name : Cleanup on failure
127- if : failure()
128- run : |
129- echo "Import test failed. Checking environment status..."
130- docker ps
0 commit comments