Skip to content

Commit b976ef5

Browse files
committed
ReferenceTester.php: Exclude few bundles when using debug:router
1 parent ad1a184 commit b976ef5

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tools/raml2html/src/Test/ReferenceTester.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,35 @@ class ReferenceTester
1212

1313
public const DEFAULT_FILE_LIST = [
1414
'vendor/ibexa/rest/src/bundle/Resources/config/routing.yml',
15-
// `find vendor/ibexa -name "*rest*.yaml" -and -wholename "*rout*" -and -not -wholename "*test*" | sort`
16-
'vendor/ibexa/activity-log/src/bundle/Resources/config/routing/rest.yaml', // directly prefixed /api/ibexa/v2
15+
// `find vendor/ibexa -wholename "*rout*rest*.y*ml" -and -not -wholename "*test*" | sort`
16+
'vendor/ibexa/activity-log/src/bundle/Resources/config/routing/rest.yaml',
1717
//'vendor/ibexa/admin-ui/src/bundle/Resources/config/routing_rest.yaml',
1818
'vendor/ibexa/calendar/src/bundle/Resources/config/routing_rest.yaml',
1919
'vendor/ibexa/cart/src/bundle/Resources/config/routing_rest.yaml',
2020
'vendor/ibexa/connect/src/bundle/Resources/config/routing_rest.yaml',
2121
'vendor/ibexa/connector-dam/src/bundle/Resources/config/routing_rest.yaml',
2222
'vendor/ibexa/connector-qualifio/src/bundle/Resources/config/routing_rest.yaml',
23-
//'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing_rest.yaml', // imports the 4 following files
2423
'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing/rest/companies.yaml',
2524
'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing/rest/members.yaml',
2625
'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing/rest/sales_representatives.yaml',
2726
'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing/rest/root.yaml',
27+
//'vendor/ibexa/corporate-account/src/bundle/Resources/config/routing_rest.yaml', // only imports the 4 previous files
2828
'vendor/ibexa/fieldtype-query/src/bundle/Resources/config/routing/rest.yaml',
2929
'vendor/ibexa/order-management/src/bundle/Resources/config/routing_rest.yaml',
3030
'vendor/ibexa/payment/src/bundle/Resources/config/routing_rest.yaml',
31-
//'vendor/ibexa/personalization/src/bundle/Resources/config/routing_rest.yaml', // prefixed /personalization/v1
32-
'vendor/ibexa/product-catalog/src/bundle/Resources/config/routing_rest.yaml', // contains few /personalization/v1
31+
//'vendor/ibexa/personalization/src/bundle/Resources/config/routing_rest.yaml', // prefixed /api/ibexa/v2/personalization/v1
32+
'vendor/ibexa/product-catalog/src/bundle/Resources/config/routing_rest.yaml', // contains few /api/ibexa/v2/personalization/v1
3333
//'vendor/ibexa/scheduler/src/bundle/Resources/config/routing_rest.yaml', // prefixed /api/datebasedpublisher/v1
3434
'vendor/ibexa/segmentation/src/bundle/Resources/config/routing_rest.yaml',
3535
'vendor/ibexa/shipping/src/bundle/Resources/config/routing/rest.yaml',
3636
'vendor/ibexa/taxonomy/src/bundle/Resources/config/routing_rest.yaml',
3737
];
3838

39+
public const EXCLUDED_BUNDLE_LIST = [
40+
'Ibexa\Bundle\AdminUi',
41+
'Ibexa\Bundle\Personalization',
42+
];
43+
3944
public const METHOD_LIST = [
4045
'OPTIONS',
4146
'GET',
@@ -154,7 +159,7 @@ private function parseRouterOutput($consolePath)
154159
{
155160
$confRoutes = [];
156161

157-
$routerCommand = 'debug:router --format=txt';
162+
$routerCommand = 'debug:router --format=txt --show-controllers';
158163
$consolePathLastChar = substr($consolePath, -1);
159164
if (in_array($consolePathLastChar, ['"', "'"])) {
160165
$consoleCommand = substr($consolePath, 0, -1) . " {$routerCommand}{$consolePathLastChar}";
@@ -170,9 +175,13 @@ private function parseRouterOutput($consolePath)
170175
continue;
171176
}
172177
$lineParts = preg_split('/\s+/', $outputLine);
173-
$routeProperties = array_combine(['Name', 'Method', 'Scheme', 'Host', 'Path'], $lineParts);
178+
$routeProperties = array_combine(['Name', 'Method', 'Scheme', 'Host', 'Path', 'Controller'], $lineParts);
174179
$routeId = $routeProperties['Name'];
175180
$methods = explode('|', $routeProperties['Method']);
181+
$bundle = implode('\\', array_slice(explode('\\', $routeProperties['Controller']), 0, 3));
182+
if (in_array($bundle, self::EXCLUDED_BUNDLE_LIST)) {
183+
continue;
184+
}
176185
foreach ($methods as $method) {
177186
if ('OPTIONS' === $method) {
178187
continue;

0 commit comments

Comments
 (0)