Skip to content

Commit 8922287

Browse files
committed
mongo removed xml php config
1 parent 55f53db commit 8922287

File tree

11 files changed

+96
-45
lines changed

11 files changed

+96
-45
lines changed

src/Metadata/Tests/Util/PropertyInfoToTypeInfoHelperTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function testConvertLegacyTypesToType(?Type $type, ?array $legacyTypes):
4444
*/
4545
public static function convertLegacyTypesToTypeDataProvider(): iterable
4646
{
47+
if (!class_exists(LegacyType::class)) {
48+
return [];
49+
}
50+
4751
yield [null, null];
4852
yield [Type::null(), [new LegacyType('null')]];
4953
// yield [Type::void(), [new LegacyType('void')]];
@@ -78,6 +82,10 @@ public function testConvertTypeToLegacyTypes(?array $legacyTypes, ?Type $type):
7882
*/
7983
public static function convertTypeToLegacyTypesDataProvider(): iterable
8084
{
85+
if (!class_exists(LegacyType::class)) {
86+
return [];
87+
}
88+
8189
yield [null, null];
8290
yield [null, Type::mixed()];
8391
yield [null, Type::never()];
@@ -105,11 +113,4 @@ public static function convertTypeToLegacyTypesDataProvider(): iterable
105113
];
106114
yield [[new LegacyType('object', false, \Stringable::class), new LegacyType('object', false, \Traversable::class)], Type::intersection(Type::object(\Traversable::class), Type::object(\Stringable::class))];
107115
}
108-
109-
protected function setUp(): void
110-
{
111-
if (!class_exists(LegacyType::class)) {
112-
$this->markTestSkipped();
113-
}
114-
}
115116
}

tests/Fixtures/app/config/reference.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@
464464
* platform_service?: scalar|null, // Deprecated: The "platform_service" configuration key is deprecated since doctrine-bundle 2.9. DBAL 4 will not support setting a custom platform via connection params anymore.
465465
* auto_commit?: bool,
466466
* schema_filter?: scalar|null,
467-
* logging?: bool, // Default: true
468-
* profiling?: bool, // Default: true
467+
* logging?: bool, // Default: false
468+
* profiling?: bool, // Default: false
469469
* profiling_collect_backtrace?: bool, // Enables collecting backtraces when profiling is enabled // Default: false
470470
* profiling_collect_schema_errors?: bool, // Enables collecting schema errors when profiling is enabled // Default: true
471471
* disable_type_comments?: bool,
@@ -604,7 +604,7 @@
604604
* pool?: scalar|null,
605605
* },
606606
* region_lock_lifetime?: scalar|null, // Default: 60
607-
* log_enabled?: bool, // Default: true
607+
* log_enabled?: bool, // Default: false
608608
* region_lifetime?: scalar|null, // Default: 3600
609609
* enabled?: bool, // Default: true
610610
* factory?: scalar|null,
@@ -997,7 +997,7 @@
997997
* http_method_override?: bool, // Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. // Default: false
998998
* allowed_http_method_override?: list<string>|null,
999999
* trust_x_sendfile_type_header?: scalar|null, // Set true to enable support for xsendfile in binary file responses. // Default: "%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%"
1000-
* ide?: scalar|null, // Default: "%env(default::SYMFONY_IDE)%"
1000+
* ide?: scalar|null, // Default: null
10011001
* test?: bool,
10021002
* default_locale?: scalar|null, // Default: "en"
10031003
* set_locale_from_accept_language?: bool, // Whether to use the Accept-Language HTTP header to set the Request locale (only when the "_locale" request attribute is not passed). // Default: false
@@ -1154,7 +1154,7 @@
11541154
* paths?: array<string, scalar|null>,
11551155
* excluded_patterns?: list<scalar|null>,
11561156
* exclude_dotfiles?: bool, // If true, any files starting with "." will be excluded from the asset mapper. // Default: true
1157-
* server?: bool, // If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default). // Default: true
1157+
* server?: bool, // If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default). // Default: false
11581158
* public_prefix?: scalar|null, // The public path where the assets will be written to (and served from when "server" is true). // Default: "/assets/"
11591159
* missing_import_mode?: "strict"|"warn"|"ignore", // Behavior if an asset cannot be found when imported from JavaScript or CSS files - e.g. "import './non-existent.js'". "strict" means an exception is thrown, "warn" means a warning is logged, "ignore" means the import is left as-is. // Default: "warn"
11601160
* extensions?: array<string, scalar|null>,
@@ -1274,7 +1274,7 @@
12741274
* },
12751275
* php_errors?: array{ // PHP errors handling configuration
12761276
* log?: mixed, // Use the application logger instead of the PHP logger for logging PHP errors. // Default: true
1277-
* throw?: bool, // Throw PHP errors as \ErrorException instances. // Default: true
1277+
* throw?: bool, // Throw PHP errors as \ErrorException instances. // Default: false
12781278
* },
12791279
* exceptions?: array<string, array{ // Default: []
12801280
* log_level?: scalar|null, // The level of log message. Null to let Symfony decide. // Default: null
@@ -1337,7 +1337,7 @@
13371337
* scheduler?: bool|array{ // Scheduler configuration
13381338
* enabled?: bool, // Default: false
13391339
* },
1340-
* disallow_search_engine_index?: bool, // Enabled by default when debug is enabled. // Default: true
1340+
* disallow_search_engine_index?: bool, // Enabled by default when debug is enabled. // Default: false
13411341
* http_client?: bool|array{ // HTTP Client configuration
13421342
* enabled?: bool, // Default: true
13431343
* max_host_connections?: int, // The maximum number of connections to a single host.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_main:
2-
resource: routing_test.yml
2+
resource: routing_test.php
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
15+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
16+
17+
return function (RoutingConfigurator $routes) {
18+
$routes->import('routing_common.yml');
19+
$routes->import('@TestBundle/Controller/MongoDbOdm', 'attribute');
20+
21+
if (class_exists(WebProfilerBundle::class)) {
22+
// 2. Resolve the actual directory of the bundle
23+
$reflection = new ReflectionClass(WebProfilerBundle::class);
24+
$bundleDir = dirname($reflection->getFileName());
25+
26+
// 3. Check if the PHP config exists on the filesystem
27+
$usePhp = file_exists($bundleDir.'/Resources/config/routing/wdt.php');
28+
$ext = $usePhp ? 'php' : 'xml';
29+
30+
// 4. Import dynamically based on the extension found
31+
$routes->import("@WebProfilerBundle/Resources/config/routing/wdt.$ext")
32+
->prefix('/_wdt');
33+
34+
$routes->import("@WebProfilerBundle/Resources/config/routing/profiler.$ext")
35+
->prefix('/_profiler');
36+
}
37+
};
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
11
_main:
2-
resource: routing_common.yml
3-
4-
controller:
5-
resource: '@TestBundle/Controller/MongoDbOdm'
6-
type: attribute
7-
8-
web_profiler_wdt:
9-
resource: '@WebProfilerBundle/Resources/config/routing/wdt.php'
10-
prefix: /_wdt
11-
12-
web_profiler_profiler:
13-
resource: '@WebProfilerBundle/Resources/config/routing/profiler.php'
14-
prefix: /_profiler
2+
resource: routing_mongodb.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_main:
2-
resource: routing_test.yml
2+
resource: routing_test.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_main:
2-
resource: routing_test.yml
2+
resource: routing_test.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_main:
2-
resource: routing_test.yml
2+
resource: routing_test.php
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_main:
2-
resource: routing_test.yml
2+
resource: routing_test.php
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
15+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
16+
17+
return function (RoutingConfigurator $routes) {
18+
$routes->import('routing_common.yml');
19+
$routes->import('@TestBundle/Controller/Orm', 'attribute');
20+
21+
if (class_exists(WebProfilerBundle::class)) {
22+
// 2. Resolve the actual directory of the bundle
23+
$reflection = new ReflectionClass(WebProfilerBundle::class);
24+
$bundleDir = dirname($reflection->getFileName());
25+
26+
// 3. Check if the PHP config exists on the filesystem
27+
$usePhp = file_exists($bundleDir.'/Resources/config/routing/wdt.php');
28+
$ext = $usePhp ? 'php' : 'xml';
29+
30+
// 4. Import dynamically based on the extension found
31+
$routes->import("@WebProfilerBundle/Resources/config/routing/wdt.$ext")
32+
->prefix('/_wdt');
33+
34+
$routes->import("@WebProfilerBundle/Resources/config/routing/profiler.$ext")
35+
->prefix('/_profiler');
36+
}
37+
};

0 commit comments

Comments
 (0)