Fix code quality violations and enhance ROUTE-EXISTS-01 rule
Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
63
app/RSpade/tests/basic/01_framework_verification/README.md
Executable file
63
app/RSpade/tests/basic/01_framework_verification/README.md
Executable file
@@ -0,0 +1,63 @@
|
||||
# Framework Verification Test
|
||||
|
||||
Meta-test that verifies the testing framework itself works correctly.
|
||||
|
||||
## What it verifies
|
||||
|
||||
- Test environment helpers load correctly
|
||||
- `test_mode_enter()` successfully switches to test database
|
||||
- `.env` is modified to use `rspade_test`
|
||||
- `.env` backup is created
|
||||
- Database reset script works
|
||||
- Migrations run successfully on test database
|
||||
- `test_db_query()` helper works
|
||||
- Test mode cleanup/restore works via trap
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `rspade_test` database exists
|
||||
- `rspade` user has access to `rspade_test`
|
||||
- Laravel is configured normally (using `rspade` database)
|
||||
|
||||
## How to run
|
||||
|
||||
```bash
|
||||
./run_test.sh # Full test with database reset
|
||||
./run_test.sh --skip-reset # Skip database reset (faster)
|
||||
```
|
||||
|
||||
## What happens
|
||||
|
||||
1. Loads test environment helpers
|
||||
2. Resets test database (unless --skip-reset)
|
||||
3. Enters test mode (switches to rspade_test)
|
||||
4. Runs 5 verification checks
|
||||
5. Exits test mode (restores original database)
|
||||
6. Outputs PASS or FAIL
|
||||
|
||||
## Expected output
|
||||
|
||||
```
|
||||
[SETUP] Testing framework verification...
|
||||
[SETUP] Resetting test database...
|
||||
[DB RESET] Dropping rspade_test database...
|
||||
[DB RESET] Creating rspade_test database...
|
||||
[DB RESET] Running migrations...
|
||||
[DB RESET] Database reset complete
|
||||
[TEST ENV] Entering test mode...
|
||||
[TEST ENV] Test mode active (using rspade_test database)
|
||||
[TEST] Verifying framework components...
|
||||
[TEST] ✓ Environment switched to test database
|
||||
[TEST] ✓ Test database accessible
|
||||
[TEST] ✓ Migrations ran successfully
|
||||
[TEST] ✓ Environment backup created
|
||||
[TEST] ✓ Database query helper works
|
||||
PASS: Framework Verification
|
||||
[TEST ENV] Exiting test mode...
|
||||
[TEST ENV] Test mode exited (restored original database)
|
||||
```
|
||||
|
||||
## Known limitations
|
||||
|
||||
- Database reset is slow (~5-10 seconds with migrations)
|
||||
- Future: Use database snapshots for faster reset
|
||||
87
app/RSpade/tests/basic/01_framework_verification/run_test.sh
Executable file
87
app/RSpade/tests/basic/01_framework_verification/run_test.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
TEST_NAME="Framework Verification"
|
||||
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source test environment helpers
|
||||
source "$TEST_DIR/../../_lib/test_env.sh"
|
||||
|
||||
# Parse arguments
|
||||
SKIP_RESET=false
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--skip-reset)
|
||||
SKIP_RESET=true
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Ensure test mode exits on script exit (success or failure)
|
||||
trap test_trap_exit EXIT
|
||||
|
||||
# SETUP
|
||||
echo "[SETUP] Testing framework verification..." >&2
|
||||
|
||||
# Verify test environment helpers loaded
|
||||
if ! type test_mode_enter > /dev/null 2>&1; then
|
||||
echo "FAIL: $TEST_NAME - test_mode_enter function not loaded"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Enter test mode (switches Laravel to rspade_test database and loads test config)
|
||||
test_mode_enter
|
||||
|
||||
# Reset database to known state (unless called as sub-test)
|
||||
if [ "$SKIP_RESET" = false ]; then
|
||||
echo "[SETUP] Resetting test database..." >&2
|
||||
"$TEST_DIR/../../_lib/db_reset.sh"
|
||||
fi
|
||||
|
||||
# TEST LOGIC
|
||||
echo "[TEST] Verifying framework components..." >&2
|
||||
|
||||
# Test 1: Verify .env was modified
|
||||
if grep -q "DB_DATABASE=rspade_test" /var/www/html/.env; then
|
||||
echo "[TEST] ✓ Environment switched to test database" >&2
|
||||
else
|
||||
echo "FAIL: $TEST_NAME - .env not modified to use rspade_test"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Verify we can query test database
|
||||
if ! mysql -h127.0.0.1 -urspade -prspadepass rspade_test -e "SELECT 1" > /dev/null 2>&1; then
|
||||
echo "FAIL: $TEST_NAME - Cannot connect to rspade_test database"
|
||||
exit 1
|
||||
fi
|
||||
echo "[TEST] ✓ Test database accessible" >&2
|
||||
|
||||
# Test 3: Verify migrations table exists (migrations ran)
|
||||
tables=$(mysql -h127.0.0.1 -urspade -prspadepass rspade_test -N -e "SHOW TABLES LIKE 'migrations'" 2>/dev/null)
|
||||
if [ -z "$tables" ]; then
|
||||
echo "FAIL: $TEST_NAME - Migrations table does not exist (migrations did not run)"
|
||||
exit 1
|
||||
fi
|
||||
echo "[TEST] ✓ Migrations ran successfully" >&2
|
||||
|
||||
# Test 4: Verify backup was created
|
||||
if [ ! -f "$TEST_ENV_BACKUP" ]; then
|
||||
echo "FAIL: $TEST_NAME - .env backup not created"
|
||||
exit 1
|
||||
fi
|
||||
echo "[TEST] ✓ Environment backup created" >&2
|
||||
|
||||
# Test 5: Verify test_db_query helper works
|
||||
test_result=$(test_db_query "SELECT 'works'" 2>/dev/null)
|
||||
if [ "$test_result" != "works" ]; then
|
||||
echo "FAIL: $TEST_NAME - test_db_query helper failed"
|
||||
exit 1
|
||||
fi
|
||||
echo "[TEST] ✓ Database query helper works" >&2
|
||||
|
||||
# All tests passed
|
||||
echo "PASS: $TEST_NAME"
|
||||
exit 0
|
||||
|
||||
# TEARDOWN happens automatically via trap
|
||||
Reference in New Issue
Block a user