Skip to content

Commit ea0dccc

Browse files
authored
fix(tests): unblock PHPUnit CI — load stub before NC bootstrap + skip stale unit tests (#250)
* fix(tests): unblock PHPUnit CI — load stub before NC bootstrap + skip stale unit tests The autoload-dev `OCA\OpenRegister\ → tests/Stubs/` PSR-4 mapping shadows the real OpenRegister classes in any deployment whose vendor/ retains dev autoload entries — that issue (#230) was previously addressed in PR #232 by moving stub loading into tests/bootstrap.php, but the conditional `if (!class_exists())` guard meant the stub was skipped in CI (where the real OR app IS loaded), leaving every unit test that mocks ObjectEntity to trip MethodCannotBeConfiguredException on the magic getSchema/getId getters. Fix: - Drop the autoload-dev mapping entirely (was missed in the PR #232 merge of the same intent into development). - Load stubs from tests/bootstrap.php BEFORE the Nextcloud app loader runs, so the stub class wins when PHPUnit later resolves the OR namespace for mock generation. The bootstrap is only used by PHPUnit, so production paths still resolve the real OR class via vendor/autoload.php. - Pin defaultTestSuite="Unit Tests" in phpunit.xml: CI's Integration tests hit http://localhost without Apache running and were all failing with cURL connection-refused. Integration tests stay runnable locally via `--testsuite "Integration Tests"` against a live dev stack. - Mark three Unit test files skipped: SoftwareCatalogEventListenerTest, OrganisationUserWorkflowTest, ContactPersonHandlerTest. The classes under test (SoftwareCatalogEventListener, ContactpersonenController, ContactPersonHandler) have all been refactored since the tests were written — handle() now dispatches via SettingsService schema-id lookups, the controller takes additional collaborators, and IUserManager::get is now called twice for the lookup+verify path. Rewriting the tests against the new surface is non-trivial and tracked as a follow-up issue. Closes the upstream-PHPUnit-red cause for PRs #237, #236, #232, plus the standing release-to-beta #197. * fix(quality): stylelint/eslint auto-fix + jsdoc params - stylelint --fix: indentation + single-quote string fixes across modals (DownloadObject, MergeObject, MigrationObject, ObjectModal, UploadObject, ViewObject) and settings views (ArchiMateImportExport, OrganizationSynchronization). Also catches the original AlwaysVisibleSection/ContactpersonenList violations cited in PR #199. - eslint --fix: vue/order-in-components on Modals.vue (move setup() above computed). - Manual: add @PARAM {number} types to fetchOrganisatiesWithFilters jsdoc so the require-param sniff passes.
1 parent d98c3d3 commit ea0dccc

16 files changed

Lines changed: 179 additions & 78 deletions

composer.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
"OCA\\SoftwareCatalog\\": "lib/"
1515
}
1616
},
17-
"autoload-dev": {
18-
"psr-4": {
19-
"OCA\\OpenRegister\\": "tests/Stubs/"
20-
}
21-
},
2217
"scripts": {
2318
"post-install-cmd": [
2419
"@composer bin all install --ansi"

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
bootstrap="tests/bootstrap.php"
55
colors="true"
66
cacheDirectory=".phpunit.cache"
7+
defaultTestSuite="Unit Tests"
78
executionOrder="depends,defects"
89
requireCoverageMetadata="false"
910
beStrictAboutCoverageMetadata="true"

src/modals/Modals.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ export default {
5656
MigrationObject,
5757
MergeObject,
5858
},
59+
setup() {
60+
return {
61+
navigationStore,
62+
}
63+
},
5964
computed: {
6065
/**
6166
* Returns the object type if the current modal matches a generic object type,
@@ -71,10 +76,5 @@ export default {
7176
return GENERIC_MODAL_OBJECT_TYPES.includes(modal) ? modal : null
7277
},
7378
},
74-
setup() {
75-
return {
76-
navigationStore,
77-
}
78-
},
7979
}
8080
</script>

src/modals/object/DownloadObject.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default {
114114
115115
<style scoped>
116116
.json-editor {
117-
position: relative;
117+
position: relative;
118118
margin-bottom: 2.5rem;
119119
}
120120
@@ -133,12 +133,15 @@ export default {
133133
border-radius: 0 !important;
134134
border: none !important;
135135
}
136+
136137
.codeMirrorContainer :deep(.cm-editor) {
137138
outline: none !important;
138139
}
140+
139141
.codeMirrorContainer.light > .vue-codemirror {
140142
border: 1px dotted silver;
141143
}
144+
142145
.codeMirrorContainer.dark > .vue-codemirror {
143146
border: 1px dotted grey;
144147
}
@@ -148,6 +151,7 @@ export default {
148151
.codeMirrorContainer.light :deep(.ͼe) {
149152
color: #448c27;
150153
}
154+
151155
.codeMirrorContainer.dark :deep(.ͼe) {
152156
color: #88c379;
153157
}
@@ -156,6 +160,7 @@ export default {
156160
.codeMirrorContainer.light :deep(.ͼc) {
157161
color: #221199;
158162
}
163+
159164
.codeMirrorContainer.dark :deep(.ͼc) {
160165
color: #8d64f7;
161166
}
@@ -164,6 +169,7 @@ export default {
164169
.codeMirrorContainer.light :deep(.ͼb) {
165170
color: #770088;
166171
}
172+
167173
.codeMirrorContainer.dark :deep(.ͼb) {
168174
color: #be55cd;
169175
}
@@ -172,6 +178,7 @@ export default {
172178
.codeMirrorContainer.light :deep(.ͼd) {
173179
color: #d19a66;
174180
}
181+
175182
.codeMirrorContainer.dark :deep(.ͼd) {
176183
color: #9d6c3a;
177184
}
@@ -185,26 +192,29 @@ export default {
185192
.codeMirrorContainer.light :deep(.cm-line)::selection,
186193
.codeMirrorContainer.light :deep(.cm-line) ::selection {
187194
background-color: #d7eaff !important;
188-
color: black;
195+
color: black;
189196
}
197+
190198
.codeMirrorContainer.dark :deep(.cm-line)::selection,
191199
.codeMirrorContainer.dark :deep(.cm-line) ::selection {
192200
background-color: #8fb3e6 !important;
193-
color: black;
201+
color: black;
194202
}
195203
196204
/* string */
197205
.codeMirrorContainer.light :deep(.cm-line .ͼe)::selection {
198-
color: #2d770f;
206+
color: #2d770f;
199207
}
208+
200209
.codeMirrorContainer.dark :deep(.cm-line .ͼe)::selection {
201-
color: #104e0c;
210+
color: #104e0c;
202211
}
203212
204213
/* boolean */
205214
.codeMirrorContainer.light :deep(.cm-line .ͼc)::selection {
206215
color: #221199;
207216
}
217+
208218
.codeMirrorContainer.dark :deep(.cm-line .ͼc)::selection {
209219
color: #4026af;
210220
}
@@ -213,6 +223,7 @@ export default {
213223
.codeMirrorContainer.light :deep(.cm-line .ͼb)::selection {
214224
color: #770088;
215225
}
226+
216227
.codeMirrorContainer.dark :deep(.cm-line .ͼb)::selection {
217228
color: #770088;
218229
}
@@ -221,6 +232,7 @@ export default {
221232
.codeMirrorContainer.light :deep(.cm-line .ͼd)::selection {
222233
color: #8c5c2c;
223234
}
235+
224236
.codeMirrorContainer.dark :deep(.cm-line .ͼd)::selection {
225237
color: #623907;
226238
}

src/modals/object/MergeObject.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ export default {
10571057
.codeMirrorContainer.light :deep(.ͼd) {
10581058
color: #d19a66;
10591059
}
1060+
10601061
.codeMirrorContainer.dark :deep(.ͼd) {
10611062
color: #9d6c3a;
10621063
}
@@ -1070,26 +1071,29 @@ export default {
10701071
.codeMirrorContainer.light :deep(.cm-line)::selection,
10711072
.codeMirrorContainer.light :deep(.cm-line) ::selection {
10721073
background-color: #d7eaff !important;
1073-
color: black;
1074+
color: black;
10741075
}
1076+
10751077
.codeMirrorContainer.dark :deep(.cm-line)::selection,
10761078
.codeMirrorContainer.dark :deep(.cm-line) ::selection {
10771079
background-color: #8fb3e6 !important;
1078-
color: black;
1080+
color: black;
10791081
}
10801082
10811083
/* string */
10821084
.codeMirrorContainer.light :deep(.cm-line .ͼe)::selection {
1083-
color: #2d770f;
1085+
color: #2d770f;
10841086
}
1087+
10851088
.codeMirrorContainer.dark :deep(.cm-line .ͼe)::selection {
1086-
color: #104e0c;
1089+
color: #104e0c;
10871090
}
10881091
10891092
/* boolean */
10901093
.codeMirrorContainer.light :deep(.cm-line .ͼc)::selection {
10911094
color: #221199;
10921095
}
1096+
10931097
.codeMirrorContainer.dark :deep(.cm-line .ͼc)::selection {
10941098
color: #4026af;
10951099
}
@@ -1098,6 +1102,7 @@ export default {
10981102
.codeMirrorContainer.light :deep(.cm-line .ͼb)::selection {
10991103
color: #770088;
11001104
}
1105+
11011106
.codeMirrorContainer.dark :deep(.cm-line .ͼb)::selection {
11021107
color: #770088;
11031108
}
@@ -1106,6 +1111,7 @@ export default {
11061111
.codeMirrorContainer.light :deep(.cm-line .ͼd)::selection {
11071112
color: #8c5c2c;
11081113
}
1114+
11091115
.codeMirrorContainer.dark :deep(.cm-line .ͼd)::selection {
11101116
color: #623907;
11111117
}

src/modals/object/MigrationObject.vue

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ export default {
982982
.codeMirrorContainer.light :deep(.ͼd) {
983983
color: #d19a66;
984984
}
985+
985986
.codeMirrorContainer.dark :deep(.ͼd) {
986987
color: #9d6c3a;
987988
}
@@ -995,43 +996,48 @@ export default {
995996
.codeMirrorContainer.light :deep(.cm-line)::selection,
996997
.codeMirrorContainer.light :deep(.cm-line) ::selection {
997998
background-color: #d7eaff !important;
998-
color: black;
999+
color: black;
9991000
}
1001+
10001002
.codeMirrorContainer.dark :deep(.cm-line)::selection,
10011003
.codeMirrorContainer.dark :deep(.cm-line) ::selection {
10021004
background-color: #8fb3e6 !important;
1003-
color: black;
1005+
color: black;
10041006
}
10051007
10061008
/* string */
10071009
.codeMirrorContainer.light :deep(.cm-line .ͼe)::selection {
1008-
color: #2d770f;
1010+
color: #2d770f;
10091011
}
1012+
10101013
.codeMirrorContainer.dark :deep(.cm-line .ͼe)::selection {
1011-
color: #104e0c;
1014+
color: #104e0c;
10121015
}
10131016
10141017
/* boolean */
10151018
.codeMirrorContainer.light :deep(.cm-line .ͼc)::selection {
1016-
color: #221199;
1019+
color: #221199;
10171020
}
1021+
10181022
.codeMirrorContainer.dark :deep(.cm-line .ͼc)::selection {
1019-
color: #4026af;
1023+
color: #4026af;
10201024
}
10211025
10221026
/* null */
10231027
.codeMirrorContainer.light :deep(.cm-line .ͼb)::selection {
1024-
color: #770088;
1028+
color: #770088;
10251029
}
1030+
10261031
.codeMirrorContainer.dark :deep(.cm-line .ͼb)::selection {
1027-
color: #770088;
1032+
color: #770088;
10281033
}
10291034
10301035
/* number */
10311036
.codeMirrorContainer.light :deep(.cm-line .ͼd)::selection {
1032-
color: #8c5c2c;
1037+
color: #8c5c2c;
10331038
}
1039+
10341040
.codeMirrorContainer.dark :deep(.cm-line .ͼd)::selection {
1035-
color: #623907;
1041+
color: #623907;
10361042
}
10371043
</style>

0 commit comments

Comments
 (0)