Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b09c20

Browse files
committed
chore: decouple from framework bundle (#882)
1 parent 3ba0257 commit 0b09c20

4 files changed

Lines changed: 48 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,43 @@ jobs:
178178
./phpunit --testsuite reset-database --bootstrap tests/bootstrap-reset-database.php
179179
shell: bash
180180

181+
test-no-framework:
182+
name: No framework - PHP${{ matrix.php }}
183+
runs-on: ubuntu-latest
184+
strategy:
185+
fail-fast: false
186+
matrix:
187+
php: [ 8.1, 8.2, 8.3, 8.4 ]
188+
steps:
189+
- name: Checkout code
190+
uses: actions/checkout@v3
191+
192+
- name: Setup PHP
193+
uses: shivammathur/setup-php@v2
194+
with:
195+
php-version: ${{ matrix.php }}
196+
coverage: none
197+
tools: flex
198+
199+
- name: Install dependencies
200+
uses: ramsey/composer-install@v2
201+
with:
202+
composer-options: --prefer-dist
203+
204+
- name: Remove
205+
run: |
206+
composer remove --dev \
207+
dama/doctrine-test-bundle \
208+
doctrine/doctrine-bundle \
209+
doctrine/doctrine-migrations-bundle \
210+
doctrine/mongodb-odm-bundle \
211+
symfony/maker-bundle \
212+
symfony/framework-bundle
213+
214+
- name: Test
215+
run: |
216+
vendor/bin/phpunit tests/Unit
217+
181218
test-with-paratest:
182219
name: Test with paratest
183220
runs-on: ubuntu-latest

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=8.1",
20-
"doctrine/persistence": "^2.0|^3.0|^4.0",
2120
"fakerphp/faker": "^1.23",
2221
"symfony/deprecation-contracts": "^2.2|^3.0",
23-
"symfony/framework-bundle": "^6.4|^7.0",
2422
"symfony/property-access": "^6.4|^7.0",
2523
"symfony/property-info": "^6.4|^7.0",
2624
"symfony/var-exporter": "^6.4.9|~7.0.9|^7.1.2",
@@ -36,10 +34,12 @@
3634
"doctrine/doctrine-migrations-bundle": "^2.2|^3.0",
3735
"doctrine/mongodb-odm": "^2.4",
3836
"doctrine/mongodb-odm-bundle": "^4.6|^5.0",
37+
"doctrine/persistence": "^2.0|^3.0|^4.0",
3938
"doctrine/orm": "^2.16|^3.0",
4039
"phpunit/phpunit": "^9.5.0 || ^10.0 || ^11.0 || ^12.0",
4140
"symfony/console": "^6.4|^7.0",
4241
"symfony/dotenv": "^6.4|^7.0",
42+
"symfony/framework-bundle": "^6.4|^7.0",
4343
"symfony/maker-bundle": "^1.55",
4444
"symfony/phpunit-bridge": "^6.4|^7.0",
4545
"symfony/runtime": "^6.4|^7.0",
@@ -76,6 +76,10 @@
7676
"symfony/runtime": false
7777
}
7878
},
79+
"conflict": {
80+
"doctrine/persistence": "<2.0",
81+
"symfony/framework-bundle": "<6.4"
82+
},
7983
"extra": {
8084
"bamarni-bin": {
8185
"target-directory": "bin/tools",

tests/Fixture/TestKernel.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
4747
],
4848
]);
4949

50-
// prevent a deprecation notice in Symfony 6.4
51-
if (\str_starts_with(self::VERSION, '6.4')) {
52-
$c->loadFromExtension('framework', ['handle_all_throwables' => true]);
53-
}
54-
5550
$c->register(ArrayFactory::class)->setAutowired(true)->setAutoconfigured(true);
5651
$c->register(Object1Factory::class)->setAutowired(true)->setAutoconfigured(true);
5752
$c->register(ServiceStory::class)->setAutowired(true)->setAutoconfigured(true);

tests/Unit/ZenstruckFoundryBundleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1717
use PHPUnit\Framework\Attributes\Test;
1818
use PHPUnit\Framework\TestCase;
19+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
1920
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
2021
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
2122
use Symfony\Component\Config\Definition\Loader\DefinitionFileLoader;
@@ -43,6 +44,10 @@ final class ZenstruckFoundryBundleTest extends TestCase
4344

4445
protected function setUp(): void
4546
{
47+
if (!\class_exists(FrameworkBundle::class)) {
48+
self::markTestSkipped('symfony/framework-bundle needed.');
49+
}
50+
4651
$this->container = new ContainerBuilder(new ParameterBag([
4752
'kernel.bundles' => [],
4853
'kernel.cache_dir' => \sys_get_temp_dir(),

0 commit comments

Comments
 (0)