Contributing¶
This document describes the development guidelines and process for contributions to the calServer project.
Setting Up the Development Environment¶
Prerequisites¶
- Docker and Docker Compose
- Git
- PHP 7.4 (for local analysis and IDE support)
- Java 21 (only for changes to the Report Runner)
Local Setup¶
-
Clone the repository:
-
Configure environment variables:
-
Start containers:
-
Initialize the database:
The application is then accessible at the configured domain.
Git Workflow¶
Branch Strategy¶
The project uses a Git Flow-like workflow:
| Branch | Purpose |
|---|---|
master |
Production state, only updated via releases |
develop |
Integration branch for the next version |
feature/<name> |
New features |
bugfix/<name> |
Bug fixes |
hotfix/<name> |
Urgent fixes to the production state |
release/<version> |
Preparation of a release |
Naming Conventions¶
- Branch names in lowercase with hyphens:
feature/dcc-xml-export - Issue reference in the branch name, if available:
bugfix/1234-fix-grid-sorting
Commit Messages¶
Commit messages follow this format:
Types:
| Type | Usage |
|---|---|
feat |
New feature |
fix |
Bug fix |
refactor |
Code restructuring without functional change |
docs |
Documentation changes |
test |
Adding or modifying tests |
chore |
Build scripts, dependencies, configuration |
Code Standards¶
PHP¶
- Indentation: Tabs
- Braces: Opening brace on the same line
- Naming: CamelCase for classes, camelCase for methods and variables
- Yii conventions: Controller actions as
actionMethodName, models with table name - No unnecessary
usestatements -- Yii 1.1 usesimportin the configuration
Database Migrations¶
Schema changes are made exclusively via Yii migrations:
Each migration must implement an up() and a down() method.
Frontend¶
- JavaScript: jQuery (provided by the Yii framework)
- CSS: Bootstrap 3 (via the Booster extension)
- Templates: Yii PHP views under
views/
Pull Request Process¶
- Create a feature or bugfix branch from
develop - Implement the changes with meaningful commits
- Ensure that existing tests continue to pass
- Create a pull request against
develop - Describe the change, the reason, and the test coverage in the PR
- Wait for a code review by at least one reviewer
- After approval, the branch is merged into
develop
Review Criteria¶
- Code adheres to the described standards
- Database migrations are present and reversible
- No hard-coded configuration values
- Tenant isolation is maintained
- Permission checks are present
Testing¶
Test Types¶
| Type | Tool | Directory |
|---|---|---|
| Unit tests | PHPUnit | httpdocs/protected/tests/ |
| Acceptance tests | Behat | httpdocs/protected/features/ |
| API tests | Behat | httpdocs/protected/features/api/ |
| Report Runner tests | JUnit | report-runner/src/test/ |
Running Tests¶
# PHPUnit
docker exec -it calserver ./httpdocs/protected/vendor/bin/phpunit
# Behat
docker exec -it calserver ./httpdocs/protected/vendor/bin/behat
Documentation¶
The documentation is built with MkDocs Material and is located under docs/. Local preview:
When adding new pages, the entry must be added in mkdocs.yml under nav:.