Files
care-api/bin/README.md
T
ealmeida 658b2a5136
⚡ Quick Security Scan / 🚨 Quick Vulnerability Detection (push) Failing after 26s
docs(okf): frontmatter OKF + rich abstracts nas descriptions
Normalizacao OKF dos .md: type/title/description/timestamp/layer +
descriptions factuais (rich abstracts). Apenas .md tracked; corpos intactos.
Parte da aplicacao OKF a /Dados/Dev (28-06-2026).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 22:58:20 +01:00

127 lines
2.8 KiB
Markdown

---
type: Reference
title: Readme
description: >-
This directory contains scripts to help with development, testing, and code quality for the KiviCare API plugin
timestamp: 2025-09-12T21:08:20.891192+00:00
layer: wiki
---
# Development Scripts
This directory contains scripts to help with development, testing, and code quality for the KiviCare API plugin.
## 🧪 Testing Scripts
### `install-wp-tests.sh`
Sets up the WordPress testing environment for PHPUnit tests.
```bash
# Install with default database settings
./bin/install-wp-tests.sh wordpress_test root '' localhost latest
# Or use composer script
composer run setup:tests
```
### `run-tests.sh`
Comprehensive test runner with multiple options.
```bash
# Run all tests
./bin/run-tests.sh
# Run specific test suite
./bin/run-tests.sh --suite unit
./bin/run-tests.sh --suite integration
./bin/run-tests.sh --suite contract
./bin/run-tests.sh --suite performance
# Run tests with coverage report
./bin/run-tests.sh --coverage
```
## 🔍 Code Quality Scripts
### `code-quality.sh`
Runs code quality checks including PHPCS, syntax checking, and WordPress-specific validation.
```bash
# Check code quality
./bin/code-quality.sh
# Auto-fix issues where possible
./bin/code-quality.sh --fix
# Check specific directory
./bin/code-quality.sh --target tests
# Verbose output
./bin/code-quality.sh --verbose
```
## 📦 Composer Scripts
Use these convenient composer commands:
```bash
# Code Style
composer run phpcs # Check coding standards
composer run phpcbf # Auto-fix coding standards
composer run quality # Full quality check
composer run quality:fix # Quality check with auto-fix
# Testing
composer run phpunit # Run all tests
composer run test:unit # Unit tests only
composer run test:integration # Integration tests only
composer run test:contract # Contract tests only
composer run test:coverage # Tests with coverage report
# Setup
composer run setup:tests # Install WordPress test environment
```
## 🚀 Quick Start
1. **Set up development environment:**
```bash
composer install
composer run setup:tests
```
2. **Run quality checks:**
```bash
composer run quality:fix
```
3. **Run tests:**
```bash
composer run test
```
## 📋 Requirements
- PHP 8.1+
- MySQL/MariaDB (for test database)
- WordPress test environment
- Composer dependencies installed
## 🐛 Troubleshooting
### WordPress Test Environment Issues
If you see "Could not find WordPress test suite", run:
```bash
composer run setup:tests
```
### PHP Extensions Missing
If you get extension errors, install required PHP extensions:
```bash
sudo apt install php8.1-dom php8.1-xml php8.1-curl php8.1-mbstring
```
### Database Connection Issues
Ensure MySQL is running and accessible with the credentials used in the setup script.