135 lines
2.1 KiB
Markdown
135 lines
2.1 KiB
Markdown
# Development Commands
|
|
|
|
## Testing
|
|
```bash
|
|
# Run all tests
|
|
composer test
|
|
./vendor/bin/phpunit
|
|
|
|
# Run single test file
|
|
./vendor/bin/phpunit tests/unit/HealthTest.php
|
|
|
|
# Run single test method
|
|
./vendor/bin/phpunit tests/unit/HealthTest.php --filter testIsDefinedAppPath
|
|
|
|
# Generate code coverage report
|
|
./vendor/bin/phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m
|
|
```
|
|
|
|
## Development Server
|
|
```bash
|
|
# Start development server
|
|
php spark serve
|
|
```
|
|
|
|
## Code Generation (CLI)
|
|
```bash
|
|
# Create controller
|
|
php spark make:controller Admin
|
|
|
|
# Create model
|
|
php spark make:model User
|
|
```
|
|
|
|
## Routing
|
|
```bash
|
|
# List all routes
|
|
php spark list
|
|
```
|
|
|
|
## Git Commands (Windows)
|
|
```bash
|
|
# Check git status
|
|
git status
|
|
|
|
# Check git diff
|
|
git diff
|
|
|
|
# View recent commits
|
|
git log
|
|
|
|
# Add files to staging
|
|
git add .
|
|
|
|
# Create commit
|
|
git commit -m "message"
|
|
|
|
# Push to remote
|
|
git push
|
|
|
|
# Pull from remote
|
|
git pull
|
|
```
|
|
|
|
## File System Commands (Windows)
|
|
```bash
|
|
# List directory contents
|
|
ls
|
|
dir
|
|
|
|
# Change directory
|
|
cd directory_name
|
|
|
|
# Create directory
|
|
mkdir directory_name
|
|
|
|
# Copy files
|
|
copy source destination
|
|
|
|
# Move files
|
|
move source destination
|
|
|
|
# Remove files
|
|
del filename
|
|
rm filename
|
|
|
|
# Find files by name
|
|
dir /s /b filename
|
|
|
|
# Search content in files
|
|
findstr /s /i "search_term" *.php
|
|
```
|
|
|
|
## CodeIgniter-Specific
|
|
```bash
|
|
# Clear cache
|
|
php spark cache:clear
|
|
|
|
# Clear view cache
|
|
php spark cache:clear
|
|
|
|
# Install dependencies
|
|
composer install
|
|
composer update
|
|
|
|
# Dump autoload
|
|
composer dump-autoload
|
|
```
|
|
|
|
## What to do after completing a task
|
|
|
|
1. **Run tests**
|
|
```bash
|
|
composer test
|
|
```
|
|
|
|
2. **Check for errors**
|
|
- Review any output from tests
|
|
- Check for lint errors or warnings
|
|
|
|
3. **Verify the changes**
|
|
- Test the functionality manually
|
|
- Check if any routes or filters were affected
|
|
|
|
4. **Update documentation** (if needed)
|
|
- Add new routes to documentation
|
|
- Update CHECKLIST.md if it's a new feature
|
|
|
|
5. **Commit changes** (only when explicitly asked)
|
|
```bash
|
|
git add .
|
|
git commit -m "describe changes"
|
|
```
|
|
|
|
**Important**: Never commit changes unless explicitly asked by the user.
|