Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "Studio Backend Bundle",
"dockerComposeFile": ["../docker-compose.yml"],
"service": "php-studio-backend-bundle",
"workspaceFolder": "/var/cli",
"runServices": [
"php-studio-backend-bundle"
],
"overrideCommand": false,

"features": {
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"GitHub.vscode-pull-request-github",
"GitHub.copilot", // AI pair programmer
"GitHub.copilot-chat",
"xdebug.php-debug", // PHP Debug
"whatwedo.twig", // Twig
"MehediDracula.php-namespace-resolver", // Namespace Resolver
"neilbrayfield.php-docblocker", // DocBlocker
"ikappas.composer", // Composer
"nicoDevelopp.vscode-symfony-pack", // Symfony Pack
"phpstan.phpstan-vscode", // PHPStan
"esbenp.prettier-vscode", // Prettier
"ms-azuretools.vscode-docker", // Docker
"editorconfig.editorconfig",
"recca0120.vscode-phpunit", // PHPUnit
"DEVSENSE.phptools-vscode" // PHP IntelliSense
],
"settings": {
"php.validate.executablePath": "/usr/local/bin/php",
"php.suggest.basic": false,
"intelephense.files.maxSize": 5000000,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"files.encoding": "utf8",
"files.eol": "\n",
"files.insertFinalNewline": true,
"composer.workingPath": "/var/cli",
"composer.executablePath": "/usr/local/bin/composer",
"phpunit.args": [
"-c /var/cli/tests/phpunit.xml"
],
"phpunit.phpunit": "/var/cli/vendor/bin/phpunit"
}
}
},
"postCreateCommand": "composer install",
// Stop all compose services when the dev container closes
"shutdownAction": "stopCompose"
}
92 changes: 47 additions & 45 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
This is a php based project. php 8.3 is the minimum version required to run this project.
This is a php based project. php 8.3 is the minimum version required to run this project.
php 8.4 features are not used in this project. codeception is used for testing.

## Key Guidelines
- Do not modify `composer.json` or `composer.lock` files.

- Do not modify `composer.json` or `composer.lock` files.

## Code Standards

- Use symfony coding standards.
- Follow PSR-12 for PHP code style.
- Use spaces for indentation (4 spaces per indent level).
- Use camelCase for variable and method names, and PascalCase for class names. Constants should be in uppercase with underscores.
- Use single quotes for strings unless interpolation is needed.
- Use `===` for comparisons and avoid using `==` unless necessary.
- Make new classes final unless they are intended to be extended.
- Dont add '@param' to methods unless the parameter type is not clear from the method signature.
- Dont add '@return' to methods unless the return type is not clear from the method signature.
- Follow the principle of least surprise, meaning that code should be easy to understand and follow common conventions.
- Follow the principle of return early, meaning that if a function can return early, it should do so to avoid deep nesting.
- Use dependency injection for classes and services.
- Use interfaces for classes that are intended to be used as services.
- Use interfaces for dependency injection to allow for easier testing and mocking.
- Avoid using static methods and properties unless absolutely necessary.
- Use contructor injection for dependencies.
- Avoid using global state and singletons.
- Use constructer promotion for class properties.
- Follow the principle of minimal visibility, meaning that class properties and methods should be as private as possible.
- Use interfaces for classes that are intended to be used as services.
- Avoid using abstract classes unless absolutely necessary.
- Add a `@throws` annotation to methods that can throw exceptions, and document the exceptions that can be thrown.
- Add a new line at the end of each file. Use UTF-8 encoding for files.
- Use `null` coalescing operator (`??`) for default values when applicable.
- Use `match` expressions for simple value comparisons.
- Use `array_map`, `array_filter`, and `array_reduce` for array transformations instead of loops when applicable.
- Use `declare(strict_types=1);` at the top of each file to enforce strict typing.
- Use symfony coding standards.
- Follow PSR-12 for PHP code style.
- Use spaces for indentation (4 spaces per indent level).
- Use camelCase for variable and method names, and PascalCase for class names. Constants should be in uppercase with underscores.
- Use single quotes for strings unless interpolation is needed.
- Use `===` for comparisons and avoid using `==` unless necessary.
- Make new classes final unless they are intended to be extended.
- Dont add '@param' to methods unless the parameter type is not clear from the method signature.
- Dont add '@return' to methods unless the return type is not clear from the method signature.
- Follow the principle of least surprise, meaning that code should be easy to understand and follow common conventions.
- Follow the principle of return early, meaning that if a function can return early, it should do so to avoid deep nesting.
- Use dependency injection for classes and services.
- Use interfaces for classes that are intended to be used as services.
- Use interfaces for dependency injection to allow for easier testing and mocking.
- Avoid using static methods and properties unless absolutely necessary.
- Use contructor injection for dependencies.
- Avoid using global state and singletons.
- Use constructer promotion for class properties.
- Follow the principle of minimal visibility, meaning that class properties and methods should be as private as possible.
- Use interfaces for classes that are intended to be used as services.
- Avoid using abstract classes unless absolutely necessary.
- Add a `@throws` annotation to methods that can throw exceptions, and document the exceptions that can be thrown.
- Add a new line at the end of each file. Use UTF-8 encoding for files.
- Use `null` coalescing operator (`??`) for default values when applicable.
- Use `match` expressions for simple value comparisons.
- Use `array_map`, `array_filter`, and `array_reduce` for array transformations instead of loops when applicable.
- Use `declare(strict_types=1);` at the top of each file to enforce strict typing.

## Repository Structure

- Use the `src/` directory for application code.
- Use the `tests/Unit` directory for unit tests.
- Use the `config/` directory for configuration files.
- Use the `public/` directory for public assets and entry points.
- Use the `vendor/` directory for third-party dependencies managed by Composer.
- Use the `translations/` directory for translation files.
- Use the `doc/` directory for documentation files.
- Use the `src/` directory for application code.
- Use the `tests/Unit` directory for unit tests.
- Use the `config/` directory for configuration files.
- Use the `public/` directory for public assets and entry points.
- Use the `vendor/` directory for third-party dependencies managed by Composer.
- Use the `translations/` directory for translation files.
- Use the `doc/` directory for documentation files.

## Testing

- Use Codeception for testing.
- Follow the Codeception documentation for writing tests.
- Write unit tests for new functionality. Use mocks and stubs where applicable.
- Use `codeception.dist.yml` for Codeception configuration.
- Run tests using `vendor/bin/codecept run` command.
- Use phpunit for testing.
- Follow the phpunit documentation for writing tests.
- Write unit tests for new functionality. Use mocks and stubs where applicable.
- Use CoversClass and UsesClass attributes for test classes.
- Use `phpunit.xml.dist` for PHPUnit configuration.
- Run tests using `vendor/bin/phpunit run` command.

## Documentation

- Use `@deprecated` annotation for deprecated methods or classes.
- Use `@example` annotation for providing examples of usage.
- Keep documentation up to date with code changes.
- Suggest changes to the `doc/` folder when appropriate
- Use `@deprecated` annotation for deprecated methods or classes.
- Use `@example` annotation for providing examples of usage.
- Keep documentation up to date with code changes.
- Suggest changes to the `doc/` folder when appropriate
89 changes: 0 additions & 89 deletions .github/workflows/codeception.yaml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/phpunit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "PHPUnit Tests"

on:
workflow_dispatch:
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "feature-*"
pull_request:
types: [opened, synchronize, reopened]

env:
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}

jobs:
phpunit-tests:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: [8.3, 8.4]
dependencies: [highest]

name: "PHPUnit tests | PHP ${{ matrix.php-version }} | ${{ matrix.dependencies }}"

steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: intl, filter, zip
coverage: xdebug

- name: "Install dependencies with Composer"
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}

- name: "Run PHPUnit tests"
run: vendor/bin/phpunit --configuration= ${{ github.workspace }}/tests/phpunit-no-coverage.xml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Thumbs.db
# PhpStorm / IDEA
.idea

.phpunit.cache


# Test env
/bin
Expand All @@ -47,4 +49,4 @@ package-lock.json
/.env
/.htaccess
/auth.json
/config.json
/config.json
1 change: 1 addition & 0 deletions .phpunit.cache/test-results

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions codeception.dist.yml

This file was deleted.

6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@
"ext-filter": "*"
},
"require-dev": {
"codeception/codeception": "^5.0.10",
"roave/security-advisories": "dev-latest",
"codeception/phpunit-wrapper": "^9",
"codeception/module-asserts": "^2",
"codeception/module-symfony": "^3.1.1",
"phpstan/phpstan": "1.12.15",
"phpstan/phpstan-symfony": "^1.2.20",
"phpunit/phpunit": "10.2.7",
"phpunit/phpunit": "^12",
"nyholm/psr7": "^1",
"symfony/phpunit-bridge": "^6",
"fakerphp/faker": "^1.23"
Expand Down
Loading