Skip to content

Commit 9d54687

Browse files
antograssiotalanpoulain
authored andcommitted
Add tests on the debug bar/profiler view (#2314)
* Add tests on the debug bar/profiler view update tests to support lowest dependencies Avoid deprecation errors when booting kernel with NelmioApiDocBundle (try to fix appveyor) * Adapt tests for MongoDB
1 parent 39f74f2 commit 9d54687

File tree

12 files changed

+372
-115
lines changed

12 files changed

+372
-115
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
env: NO_UNIT_TESTS=true
1212
before_install:
1313
- composer remove --dev ext-mongodb doctrine/mongodb-odm doctrine/mongodb-odm-bundle
14-
- sed -i '26,32d' tests/Fixtures/app/config/config_common.yml
14+
- sed -i '33,39d' tests/Fixtures/app/config/config_common.yml
1515
- php: '7.2'
1616
- php: '7.3'
1717
- php: '7.3'

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ services:
3434
test_script:
3535
- cd %APPVEYOR_BUILD_FOLDER%
3636
- php vendor\behat\behat\bin\behat --format=progress --suite=default
37+
- rmdir tests\Fixtures\app\var\cache /s /q
3738
- php vendor\phpunit\phpunit\phpunit

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@
5656
"symfony/cache": "^3.4 || ^4.0",
5757
"symfony/config": "^3.4 || ^4.0",
5858
"symfony/console": "^3.4 || ^4.0",
59+
"symfony/css-selector": "^3.4 || ^4.0",
5960
"symfony/debug": "^3.4 || ^4.0",
6061
"symfony/dependency-injection": "^3.4 || ^4.0",
6162
"symfony/doctrine-bridge": "^3.4 || ^4.0",
63+
"symfony/dom-crawler": "^3.4 || ^4.0",
6264
"symfony/event-dispatcher": "^3.4 || ^4.0",
6365
"symfony/expression-language": "^3.4 || ^4.0",
6466
"symfony/finder": "^3.4 || ^4.0",
@@ -72,7 +74,7 @@
7274
"symfony/security-bundle": "^3.4 || ^4.0",
7375
"symfony/twig-bundle": "^3.4 || ^4.0",
7476
"symfony/validator": "^3.4 || ^4.0",
75-
"symfony/web-profiler-bundle": "^3.4 || ^4.0",
77+
"symfony/web-profiler-bundle": "^4.2",
7678
"symfony/yaml": "^3.4 || ^4.0",
7779
"webonyx/graphql-php": ">=0.13 <1.0"
7880
},

src/Bridge/Symfony/Bundle/Resources/views/DataCollector/request.html.twig

Lines changed: 31 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@
77
</tr>
88
{% endmacro %}
99

10+
{% macro operationTable(object, name, actualOperationName) %}
11+
{% import _self as apiPlatform %}
12+
<table>
13+
<thead>
14+
<tr>
15+
<th scope="col" class="key">{{- name|capitalize }} operations</th>
16+
<th scope="col">Attributes</th>
17+
</tr>
18+
</thead>
19+
20+
<tbody>
21+
{% for key, itemOperation in object %}
22+
{{ apiPlatform.operationLine(key, itemOperation, actualOperationName) }}
23+
{% else %}
24+
<tr>
25+
<td colspan="2" class="text-muted">
26+
No available {{ name|lower }} operation for this resource.
27+
</td>
28+
</tr>
29+
{% endfor %}
30+
</tbody>
31+
</table>
32+
{% endmacro %}
33+
1034
{% macro providerTable(object, name) %}
1135
{% if object.responses is empty %}
1236
<div class="empty">
@@ -99,56 +123,13 @@
99123
<h3 class="tab-title">Resource Metadata</h3>
100124
<div class="tab-content">
101125
<h3>Short name: "{{ collector.resourceMetadata.shortName }}"</h3>
126+
{{ apiPlatform.operationTable(collector.resourceMetadata.itemOperations, 'item', collector.requestAttributes.item_operation_name|default('')) }}
127+
{{ apiPlatform.operationTable(collector.resourceMetadata.collectionOperations, 'collection', collector.requestAttributes.collection_operation_name|default('')) }}
102128
<table>
103129
<thead>
104130
<tr>
105-
<th scope="col" class="key">
106-
Item operations
107-
</th>
108-
<th scope="col">
109-
Attributes
110-
</th>
111-
</tr>
112-
</thead>
113-
114-
<tbody>
115-
{% for key, itemOperation in collector.resourceMetadata.itemOperations %}
116-
{{ apiPlatform.operationLine(key, itemOperation, collector.requestAttributes.item_operation_name|default('')) }}
117-
{% endfor %}
118-
</tbody>
119-
</table>
120-
121-
<table>
122-
<thead>
123-
<tr>
124-
<th scope="col" class="key">
125-
Collection operations
126-
</th>
127-
<th scope="col">
128-
Attributes
129-
</th>
130-
</tr>
131-
</thead>
132-
133-
<tbody>
134-
{% for key, collectionOperation in collector.resourceMetadata.collectionOperations %}
135-
{{ apiPlatform.operationLine(key, collectionOperation, collector.requestAttributes.collection_operation_name|default('')) }}
136-
{% else %}
137-
<tr>
138-
<td colspan="2" class="text-muted">
139-
No available collection operation for this resource.
140-
</td>
141-
</tr>
142-
{% endfor %}
143-
</tbody>
144-
</table>
145-
146-
<table>
147-
<thead>
148-
<tr>
149-
<th scope="col">
150-
Filters
151-
</th>
131+
<th scope="col" class="key">Filters</th>
132+
<th scope="col"></th>
152133
</tr>
153134
</thead>
154135
<tbody>
@@ -177,22 +158,16 @@
177158
<table>
178159
<thead>
179160
<tr>
180-
<th scope="col" class="key">
181-
Attributes
182-
</th>
161+
<th scope="col" class="key">Attributes</th>
183162
<th scope="col"></th>
184163
</tr>
185164
</thead>
186165

187166
<tbody>
188167
{% for key, value in collector.resourceMetadata.attributes if key != 'filters' %}
189168
<tr>
190-
<th scope="row">
191-
{{ key }}
192-
</th>
193-
<td>
194-
{{- profiler_dump(value, 2) -}}
195-
</td>
169+
<th scope="row">{{ key }}</th>
170+
<td>{{- profiler_dump(value, 2) -}}</td>
196171
</tr>
197172
{% endfor %}
198173
</tbody>

0 commit comments

Comments
 (0)