Skip to content

Commit 8ec579e

Browse files
authored
Merge pull request #44 from MacPaw/develop
Release
2 parents de2f926 + c4afc0e commit 8ec579e

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

README.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,18 @@ By default, the bundle has the following configuration:
9292

9393
```yaml
9494
behat_api_context:
95-
kernel_reset_managers: []
96-
use_orm_context: true
95+
kernel_reset_managers:
96+
- BehatApiContext\Service\ResetManager\DoctrineResetManager
9797
```
9898
99+
The `use_orm_context` parameter is no longer configurable manually. Its value is determined automatically based on whether the Doctrine ORM is installed:
100+
> **Important:** This logic is applied internally and cannot be overridden via configuration.
101+
99102
| ORM Installed | Default `use_orm_context` |
100103
|:-------------:|:-------------------------:|
101104
| Yes | `true` |
102105
| No | `false` |
103106

104-
You can override it manually in your `config/packages/test/behat_api_context.yaml`:
105-
106-
```yaml
107-
behat_api_context:
108-
use_orm_context: false
109-
```
110-
111-
or
112-
113-
```yaml
114-
behat_api_context:
115-
use_orm_context: true
116-
```
117-
118-
depending on your needs.
119-
120107
---
121108

122109
# Usage

src/Context/ORMContext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function andISeeEntityInRepositoryWithProperties(string $entityClass, PyS
6969
*/
7070
private function seeInRepository(int $count, string $entityClass, ?array $params = null): void
7171
{
72+
/** @var class-string $entityClass */
7273
$query = $this->manager->createQueryBuilder()
7374
->from($entityClass, 'e')
7475
->select('count(e)');

src/DependencyInjection/BehatApiContextExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace BehatApiContext\DependencyInjection;
66

7-
use BehatApiContext\Context\ORMContext;
7+
use BehatApiContext\Context\ApiContext;
88
use Symfony\Component\Config\FileLocator;
99
use Symfony\Component\DependencyInjection\ContainerBuilder;
1010
use Symfony\Component\DependencyInjection\Extension\Extension;
@@ -56,7 +56,7 @@ private function loadOrmContext(
5656
$this->configureKernelResetManagers(
5757
$config,
5858
$container,
59-
ORMContext::class
59+
ApiContext::class
6060
);
6161
}
6262

tests/DependencyInjection/BehatApiContextExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testWithOrmContextEnabled(): void
3737

3838
self::assertTrue($container->hasDefinition(ORMContext::class));
3939

40-
$ormContextDefinition = $container->getDefinition(ORMContext::class);
40+
$ormContextDefinition = $container->getDefinition(ApiContext::class);
4141
$doctrineResetManagerDefinition = $container->getDefinition(DoctrineResetManager::class);
4242

4343
$methodCalls = $ormContextDefinition->getMethodCalls();

0 commit comments

Comments
 (0)