Skip to content

Commit d8bb856

Browse files
committed
Update import test workflow syntax for wp-env
- Fix npm run wp-env command syntax with proper -- -- usage - Remove admin area tests, focus on WP-CLI verification only - Test parser functionality without requiring authentication - Verify import counts, error detection, and database integrity
1 parent 9090ed8 commit d8bb856

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

.github/workflows/import-test.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ jobs:
3737
3838
- name: Activate plugins
3939
run: |
40-
npm run wp-env run cli wp plugin activate phpdoc-parser posts-to-posts
40+
npm run wp-env run cli -- -- wp plugin activate phpdoc-parser posts-to-posts
4141
4242
- name: Run sample import (subset of files)
4343
run: |
4444
# Import a small subset of WordPress core files for testing
45-
npm run wp-env run cli wp parser create /var/www/html/wp-includes/functions.php --user=admin --quick
45+
npm run wp-env run cli -- -- wp parser create /var/www/html/wp-includes/functions.php --user=admin --quick
4646
4747
- name: Verify import worked
4848
run: |
4949
# Check that functions were imported
50-
FUNCTION_COUNT=$(npm run wp-env run cli wp post list --post_type=wp-parser-function --format=count --quiet)
50+
FUNCTION_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-function --format=count | tail -1)
5151
echo "Functions imported: $FUNCTION_COUNT"
5252
5353
if [ "$FUNCTION_COUNT" -lt 50 ]; then
@@ -56,21 +56,21 @@ jobs:
5656
fi
5757
5858
# Check that classes were imported
59-
CLASS_COUNT=$(npm run wp-env run cli wp post list --post_type=wp-parser-class --format=count --quiet)
59+
CLASS_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-class --format=count | tail -1)
6060
echo "Classes imported: $CLASS_COUNT"
6161
6262
# Check that hooks were imported
63-
HOOK_COUNT=$(npm run wp-env run cli wp post list --post_type=wp-parser-hook --format=count --quiet)
63+
HOOK_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-hook --format=count | tail -1)
6464
echo "Hooks imported: $HOOK_COUNT"
6565
6666
# Check that methods were imported
67-
METHOD_COUNT=$(npm run wp-env run cli wp post list --post_type=wp-parser-method --format=count --quiet)
67+
METHOD_COUNT=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-method --format=count | tail -1)
6868
echo "Methods imported: $METHOD_COUNT"
6969
7070
- name: Test parser command with error detection
7171
run: |
7272
# Run parser and capture both stdout and stderr
73-
if ! npm run wp-env run cli wp parser create /var/www/html/wp-includes/class-wp.php --user=admin 2>&1 | tee import_output.log; then
73+
if ! npm run wp-env run cli -- -- wp parser create /var/www/html/wp-includes/class-wp.php --user=admin 2>&1 | tee import_output.log; then
7474
echo "ERROR: Parser command failed"
7575
exit 1
7676
fi
@@ -86,18 +86,18 @@ jobs:
8686
8787
- name: Verify specific function exists
8888
run: |
89-
# Test that a well-known WordPress function was parsed correctly
90-
FUNCTION_EXISTS=$(npm run wp-env run cli wp post list --post_type=wp-parser-function --name=add-action --format=count --quiet)
89+
# Test that a well-known WordPress function was parsed correctly from functions.php
90+
FUNCTION_EXISTS=$(npm run wp-env run cli -- -- wp post list --post_type=wp-parser-function --s=wp_date --format=count | tail -1)
9191
if [ "$FUNCTION_EXISTS" -eq 0 ]; then
92-
echo "ERROR: add_action function not found in parsed data"
92+
echo "ERROR: wp_date function not found in parsed data"
9393
exit 1
9494
fi
95-
echo "✓ add_action function successfully parsed"
95+
echo "✓ wp_date function successfully parsed"
9696
9797
- name: Test database integrity
9898
run: |
9999
# Check that taxonomies are properly assigned
100-
FILE_TERMS=$(npm run wp-env run cli wp term list wp-parser-source-file --format=count --quiet)
100+
FILE_TERMS=$(npm run wp-env run cli -- -- wp term list wp-parser-source-file --format=count | tail -1)
101101
echo "File taxonomy terms: $FILE_TERMS"
102102
103103
if [ "$FILE_TERMS" -eq 0 ]; then
@@ -107,15 +107,11 @@ jobs:
107107
108108
echo "✓ Database integrity checks passed"
109109
110-
- name: Test API functionality
110+
- name: Test WP-CLI functionality
111111
run: |
112-
# Basic test that WordPress is serving the parsed data
113-
if ! curl -s http://localhost:8888/wp-admin/edit.php?post_type=wp-parser-function | grep -q "wp-parser-function"; then
114-
echo "ERROR: WordPress admin not displaying parsed functions"
115-
exit 1
116-
fi
117-
118-
echo "✓ WordPress admin displaying parsed data correctly"
112+
# Test that WP-CLI is working with the parser
113+
npm run wp-env run cli -- -- wp parser --help | grep -q "create"
114+
echo "✓ WP-CLI parser command available"
119115
120116
- name: Cleanup on failure
121117
if: failure()

0 commit comments

Comments
 (0)