parent
9c4648eb94
commit
101cdb5d10
5 changed files with 151 additions and 9 deletions
|
@ -3,8 +3,13 @@ jobs:
|
|||
ls:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: git.php.fail/lubiana/container/php:8.4.1-ci
|
||||
image: php:8.4-cli
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
- name: Manually checkout
|
||||
env:
|
||||
REPO: '${{ github.repository }}'
|
||||
|
@ -34,4 +39,4 @@ jobs:
|
|||
git config --global user.email "gitbot@users.noreply.php.fail"
|
||||
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
|
||||
git push
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -6,8 +6,13 @@ jobs:
|
|||
ls:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: git.php.fail/lubiana/container/php:8.4.1-ci
|
||||
image: php:8.4-cli
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
- name: Manually checkout
|
||||
env:
|
||||
REPO: '${{ github.repository }}'
|
||||
|
@ -38,4 +43,4 @@ jobs:
|
|||
git config --global user.email "gitbot@users.noreply.php.fail"
|
||||
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
|
||||
git push
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -4,8 +4,13 @@ jobs:
|
|||
ls:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: git.php.fail/lubiana/container/php:8.4.1-ci
|
||||
image: php:8.4-cli
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git openssh-client rsync
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
- name: Manually checkout
|
||||
env:
|
||||
REPO: '${{ github.repository }}'
|
||||
|
@ -43,7 +48,3 @@ jobs:
|
|||
rsync -avz --delete deploy/ ${USERNAME}@${HOST}:${TARGETDIR} --exclude=var
|
||||
# run update script
|
||||
ssh ${USERNAME}@${HOST} /home/c3h-futtern/futtern/update.sh
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
111
.junie/guidelines.md
Normal file
111
.junie/guidelines.md
Normal file
|
@ -0,0 +1,111 @@
|
|||
# Development Guidelines for Futtern
|
||||
|
||||
This document provides essential information for developers working on the Futtern project.
|
||||
|
||||
## Build and Configuration
|
||||
|
||||
### PHP Requirements
|
||||
- PHP 8.4 or higher
|
||||
- Required extensions: ctype, iconv
|
||||
|
||||
### Database Configuration
|
||||
- Default: SQLite (`var/data.db`)
|
||||
- Can be configured for MySQL or PostgreSQL by updating the `DATABASE_URL` in `.env` or `.env.local`
|
||||
|
||||
### Installation Steps
|
||||
1. Clone the repository
|
||||
2. Install PHP dependencies:
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
3. Install Node.js dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
4. Copy static assets to Encore directory:
|
||||
```bash
|
||||
mkdir -p assets/css assets/js
|
||||
cp public/static/css/water.min.css assets/css/
|
||||
cp public/static/js/htmx.min.js assets/js/
|
||||
```
|
||||
5. Build frontend assets:
|
||||
```bash
|
||||
npm run dev # For development
|
||||
npm run build # For production
|
||||
```
|
||||
6. Create database schema:
|
||||
```bash
|
||||
php bin/console doctrine:schema:create
|
||||
```
|
||||
7. Load fixtures (optional):
|
||||
```bash
|
||||
php bin/console doctrine:fixtures:load
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
- Run `npm run watch` to automatically rebuild assets when files change
|
||||
- Use Symfony CLI for local development: `symfony server:start`
|
||||
|
||||
## Testing
|
||||
|
||||
### Test Configuration
|
||||
- Tests use Pest PHP (built on PHPUnit)
|
||||
- Test environment is configured in `.env.test`
|
||||
- Tests are organized in `tests/Feature` and `tests/Unit` directories
|
||||
|
||||
### Running Tests
|
||||
- Run all tests: `composer test`
|
||||
- Run specific tests: `composer test -- --filter=TestName`
|
||||
- Run tests in parallel: `composer test` (parallel is the default)
|
||||
|
||||
### Test Types
|
||||
1. **Unit Tests** (`tests/Unit/`):
|
||||
- Test individual classes in isolation
|
||||
- Extend `TestCase` or use standalone Pest tests
|
||||
- Example:
|
||||
```php
|
||||
test('Favicon returns SVG string', function (): void {
|
||||
$favicon = new Favicon();
|
||||
$result = (string)$favicon;
|
||||
|
||||
expect($result)
|
||||
->toBeString()
|
||||
->toContain('data:image/svg+xml')
|
||||
->toContain('transform=\'rotate(')
|
||||
->toContain('viewBox=\'0 0 512 512\'');
|
||||
})
|
||||
->covers(Favicon::class);
|
||||
```
|
||||
|
||||
2. **Feature Tests** (`tests/Feature/`):
|
||||
- Controller tests: Extend `DbWebTest` for web controllers
|
||||
- API tests: Extend `DbApiTestCase` for API endpoints
|
||||
- Each test gets a fresh database
|
||||
|
||||
### Creating New Tests
|
||||
1. Determine the appropriate test type (Unit or Feature)
|
||||
2. Create a new test file in the corresponding directory
|
||||
3. Use Pest's `test()` function to define tests
|
||||
4. Use `expect()` for assertions
|
||||
5. Use `->covers()` to specify which classes are covered by the test
|
||||
|
||||
## Code Quality
|
||||
|
||||
### Code Style
|
||||
- The project uses Easy Coding Standard (ECS) for code style checking
|
||||
- Configuration is in `ecs.php`
|
||||
- All classes should be marked as `final` unless they're meant to be extended
|
||||
- Run code style checks: `composer lint`
|
||||
|
||||
### Code Quality Tools
|
||||
- Rector is used for automated code refactoring
|
||||
- Configuration is in `rector.php`
|
||||
- Run code quality checks: `composer lint`
|
||||
|
||||
### Development Practices
|
||||
- Use strict types in all PHP files: `<?php declare(strict_types=1);`
|
||||
- Follow PSR-12 coding standards
|
||||
- Use type hints for all method parameters and return types
|
||||
- Use constructor property promotion where appropriate
|
||||
- Use readonly properties where appropriate
|
||||
- Use PHP 8.4 features where appropriate
|
20
tests/Unit/Service/FaviconTest.php
Normal file
20
tests/Unit/Service/FaviconTest.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Unit\Service;
|
||||
|
||||
use App\Service\Favicon;
|
||||
|
||||
use function expect;
|
||||
use function test;
|
||||
|
||||
test('Favicon returns SVG string', function (): void {
|
||||
$favicon = new Favicon();
|
||||
$result = (string)$favicon;
|
||||
|
||||
expect($result)
|
||||
->toBeString()
|
||||
->toContain('data:image/svg+xml')
|
||||
->toContain('transform=\'rotate(')
|
||||
->toContain('viewBox=\'0 0 512 512\'');
|
||||
})
|
||||
->covers(Favicon::class);
|
Loading…
Add table
Add a link
Reference in a new issue