You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove soyuka/phpunit fork from all composer.json files and upgrade to
PHPUnit 12.2. Update CI workflow to install PHPUnit before other steps
and configure MongoDB conditional execution. Migrate tests from Prophecy
to PHPUnit native mocking in FieldsBuilderTest and Symfony event listener
tests. Remove unused dataprovider and fix warnings.
You are a code assistant that only writes tests on the API Platform code base. You do not need to fix bugs only write the test we ask for. You do not need to run the test.
2
+
3
+
Language is PHP, project is API Platform. User will always specify either Symfony or Laravel as tests are not in the same directories.
4
+
5
+
IMPORTANT: avoid changing existing fixtures as they may alter current tests behavior. If a fixture already exist just invent new names, we don't really care about business logic here we only do tests for a framework.
6
+
7
+
# API Platform Core Development
8
+
9
+
This document provides guidelines for developing on the API Platform core.
10
+
11
+
## Laravel development:
12
+
13
+
Everything goes inside `src/Laravel`.
14
+
Tests need to run at `src/Laravel/vendor/bin/phpunit`.
15
+
Fixtures are located at `src/Laravel/workbench/app/` you can either write a DTO as ApiResource inside the `ApiResource` directory in the workbench, or add an Eloquent `Model` that gets declared as a resource with the correct attribute.
16
+
17
+
You'll add only functional testing inside `src/Laravel/Tests/`, we recommend to inspire from @src/Laravel/Tests/EloquentTest.php or @src/Laravel/Tests/JsonLdTest.php.
18
+
19
+
## Symfony development:
20
+
21
+
Fixtures are located at `tests/Fixtures/TestBundle/ApiResource/`
22
+
Entities at `tests/Fixtures/TestBundle/Entity/` and they almost always see their equivalent in `tests/Fixtures/TestBundle/Document/`
23
+
Functional tests at `tests/Functional`, unit tests are in more specific directories of each component inside `src/Component/Tests`.
24
+
25
+
## Development Commands
26
+
27
+
You can not run command only the user can. Don't attempt to run phpunit or else.
28
+
29
+
## Code Style
30
+
31
+
-**Standard:** Follow PSR-12 and the rules in `.php-cs-fixer.dist.php`.
32
+
-**Imports:** Use `use` statements for all classes, and group them by namespace.
33
+
-**Naming:**
34
+
- Classes: `PascalCase`
35
+
- Methods: `camelCase`
36
+
- Variables: `camelCase`
37
+
-**Types:** Use strict types (`declare(strict_types=1);`) in all PHP files. Use type hints for all arguments and return types where possible.
38
+
-**Error Handling:** Use exceptions for error handling.
0 commit comments