Skip to content

Commit a7ad092

Browse files
committed
Merge 4.2
2 parents e72a1ae + 2ffea23 commit a7ad092

2 files changed

Lines changed: 42 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ Unless explicitly asked otherwise:
1111
* **Project Context:** API Platform is a PHP framework supporting both Symfony and Laravel. The user will specify which framework (defaults to Symfony).
1212
* **Fixture Handling:** Avoid altering existing fixtures to prevent unintended side effects on other tests. Create new entities/DTOs/models with unique names. Business logic is secondary; focus on framework testing.
1313
* **No Test Execution by Default:** Do not run tests unless explicitly asked (to save context, as tests produce verbose output).
14+
* **No Git commit by default:** Do not commit unless explicitly asked
15+
16+
## Components
17+
18+
This code is organized through components, when you need to run a component's specific test you need to link it using:
19+
20+
```bash
21+
cd src/Laravel && composer link ../../
22+
```
23+
24+
Before running php-cs-fixer or phpstan it may be a good idea to remove the components deps:
25+
26+
```bash
27+
find src -name vendor -exec rm -r {} \;
28+
```
29+
30+
Laravel's phpstan must run from `src/Laravel` directory.
1431

1532
## Running Tests (When Asked)
1633

@@ -49,14 +66,30 @@ vendor/bin/phpunit
4966
```
5067

5168
**PHPUnit (Component-Specific):**
69+
70+
First go to the component's directory then run dependency linking:
71+
72+
```bash
73+
cd src/Metadata
74+
composer link ../../
75+
```
76+
77+
Then you can run the component's test:
78+
```bash
79+
cd src/Metadata
80+
./vendor/bin/phpunit
81+
```
82+
83+
Or from the main directory:
84+
5285
```bash
5386
# Run tests for a specific component
5487
composer {component-name} test
5588

5689
# Examples:
57-
composer doctrine-orm test
58-
composer graphql test
59-
composer metadata test
90+
composer api-platform/doctrine-orm test
91+
composer api-platform/graphql test
92+
composer api-platform/metadata test
6093
```
6194

6295
**Behat (Functional Tests):**
@@ -106,6 +139,9 @@ vendor/bin/behat --profile=mongodb-coverage --format=progress
106139

107140
**Static Analysis:**
108141
```bash
142+
# Clean up components dependencies (or else it'll try to load vendor directories and run endlessly)
143+
find src -name vendor -exec rm -r {} \;
144+
109145
# Always run PHPStan to prevent trivial bugs
110146
# CRITICAL: PHPStan requires MongoDB extension AND MongoDB ODM bundle
111147
# Install MongoDB PHP extension first (e.g., pecl install mongodb)
@@ -142,6 +178,7 @@ The event listeners mode (`USE_SYMFONY_LISTENERS=1`) changes how API Platform ho
142178
**Setup:**
143179
```bash
144180
cd src/Laravel
181+
composer link ../../
145182
composer run-script build
146183
```
147184

@@ -387,3 +424,4 @@ Follow [Conventional Commits](https://www.conventionalcommits.org/):
387424
- [ ] Documentation PR submitted (if feature)
388425
- [ ] Conventional commit format used
389426
- [ ] Code style passes (`php-cs-fixer`, `phpstan`)
427+

src/OpenApi/Tests/Factory/OpenApiFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ public function testInvoke(): void
12971297
'201' => new Response(
12981298
'Dummy resource created',
12991299
new \ArrayObject([
1300-
'application/ld+json' => new MediaType(new \ArrayObject(new \ArrayObject([]))),
1300+
'application/ld+json' => new MediaType(new \ArrayObject([])),
13011301
]),
13021302
null,
13031303
new \ArrayObject(['getDummyItem' => new Model\Link('getDummyItem', new \ArrayObject(['id' => '$response.body#/id']), null, 'This is a dummy')])

0 commit comments

Comments
 (0)