upskill-event-manager/wordpress-dev/bin/run-basic-tests.sh
bengizmo d6211ee364 feat(testing): Implement HVAC_Test_User_Factory and update .gitignore
- Add HVAC_Test_User_Factory class with:
  * User creation with specific roles
  * Multiple role support
  * Persona management system
  * Account cleanup integration
- Create comprehensive test suite in HVAC_Test_User_Factory_Test.php
- Update testing improvement plan documentation
- Add implementation decisions to project memory bank
- Restructure .gitignore with:
  * Whitelist approach for better file management
  * Explicit backup exclusions
  * Specific bin directory inclusions

Part of the Account Management component from the testing framework improvement plan.
2025-04-14 17:41:36 -03:00

56 lines
No EOL
1.5 KiB
Bash
Executable file

#!/bin/bash
# Script to run basic functionality tests
# Load environment variables
source "$(dirname "$0")/../deploy-config-staging.conf"
# Set working directory to plugin root
cd "$(dirname "$0")/.." || exit 1
# Ensure test directory exists
if [ ! -d "tests/basic" ]; then
echo "Error: Basic test directory not found"
exit 1
fi
# Determine PHPUnit command
if command -v phpunit &> /dev/null; then
PHPUNIT_CMD="phpunit"
else
if [ -f "./vendor/bin/phpunit" ]; then
PHPUNIT_CMD="./vendor/bin/phpunit"
else
echo "PHPUnit not found. Installing PHPUnit..."
composer require --dev phpunit/phpunit
PHPUNIT_CMD="./vendor/bin/phpunit"
fi
fi
echo "Using PHPUnit command: $PHPUNIT_CMD"
# Run tests
echo "Running basic functionality tests..."
$PHPUNIT_CMD --testdox \
--configuration phpunit-basic.xml \
--log-junit tests/test-results/basic/results.xml \
tests/basic/
# Create results directory if it doesn't exist
mkdir -p tests/test-results/basic
# Check exit code and display results
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "Basic tests completed successfully"
if [ -f "tests/test-results/basic/results.xml" ]; then
echo "Test results saved to tests/test-results/basic/results.xml"
fi
exit 0
else
echo "Basic tests failed with exit code $EXIT_CODE"
if [ -f "tests/test-results/basic/results.xml" ]; then
echo "See tests/test-results/basic/results.xml for details"
fi
exit $EXIT_CODE
fi