Skip to content

Testing & Development ​

Testing Instructions ​

Running Package Tests ​

bash
# Run all tests
vendor/bin/phpunit

# Run specific test suites
vendor/bin/phpunit tests/Feature/DynamicApiTest.php
vendor/bin/phpunit tests/Unit/SchemaRegistryTest.php

# Run tests with coverage
vendor/bin/phpunit --coverage-html coverage

Manual Testing ​

Create test data and verify API functionality:

bash
# Create test user
php artisan tinker
>>> $user = \App\Models\User::create(['name' => 'Test User', 'email' => 'test@example.com', 'password' => bcrypt('password')]);

# Test API endpoints
curl -X GET http://your-app.test/api/v1/users
curl -X GET http://your-app.test/api/v1/users/1
curl -X POST http://your-app.test/api/v1/users -H "Content-Type: application/json" -d '{"name":"New User","email":"new@example.com"}'

Development Setup ​

Setting up for Package Development ​

bash
# Clone the repository
git clone https://github.com/your-username/record-api.git
cd record-api

# Install dependencies
composer install

# Set up testing environment
cp .env.example .env.testing
php artisan key:generate --env=testing

# Run tests
vendor/bin/phpunit

Code Quality Tools ​

bash
# Install development tools
composer require --dev rector/rector
composer require --dev phpunit/phpunit

# Fix code style
vendor/bin/rector process src

Contributing Guidelines ​

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

Released under the MIT License.