Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/
Upload File :
Current File : /var/www/v3.cesa.co.za/run-oauth-tests.sh

#!/bin/bash

# OAuth2 API Test Runner
# This script runs the OAuth2 API tests with proper setup

echo "🚀 Starting OAuth2 API Tests..."

# Check if we're in the right directory
if [ ! -f "bin/console" ]; then
    echo "❌ Error: Please run this script from the Symfony project root directory"
    exit 1
fi

# Check if OAuth2 tables exist
echo "📋 Checking OAuth2 tables..."
OAUTH_TABLES=$(php bin/console doctrine:query:sql "SHOW TABLES LIKE 'oauth2_%'" 2>/dev/null | wc -l)

if [ "$OAUTH_TABLES" -eq 0 ]; then
    echo "❌ Error: OAuth2 tables not found. Please run the migration first:"
    echo "   php bin/console doctrine:migrations:migrate"
    exit 1
fi

echo "✅ OAuth2 tables found"

# Run the tests
echo "🧪 Running OAuth2 API tests..."

# Run specific test class
php bin/phpunit tests/EventBundle/Controller/SchoolEventControllerTest.php

# Check exit code
if [ $? -eq 0 ]; then
    echo "✅ All OAuth2 API tests passed!"
else
    echo "❌ Some OAuth2 API tests failed!"
    exit 1
fi

echo "🎉 OAuth2 API testing completed!"