Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 438bfb0

Browse files
committedSep 19, 2024·
Solr 9.6 → 9.7 for integration tests
1 parent daf9df3 commit 438bfb0

File tree

5 files changed

+388
-181
lines changed

5 files changed

+388
-181
lines changed
 

‎.github/workflows/run-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ jobs:
5151
ref: branch_8_11
5252
path: lucene-solr
5353

54-
- name: Checkout solr 9.6
54+
- name: Checkout solr 9.7
5555
if: matrix.solr == 9
5656
uses: actions/checkout@v4
5757
with:
5858
repository: apache/solr
59-
ref: branch_9_6
59+
ref: branch_9_7
6060
path: lucene-solr
6161

6262
- name: Start Solr ${{ matrix.solr }} in ${{ matrix.mode }} mode

‎src/Support/Utility.php

+18
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,22 @@ public static function compactSolrClassName(string $className): string
132132
{
133133
return preg_replace('/(?<=[a-z1-9])[a-z1-9]+(?=\.)/i', '', $className);
134134
}
135+
136+
/**
137+
* Recursively sorts an array in place by keys in ascending order.
138+
*
139+
* @param array $array
140+
*
141+
* @return bool Always returns true
142+
*/
143+
public static function recursiveKeySort(array &$array): bool
144+
{
145+
foreach ($array as &$value) {
146+
if (\is_array($value)) {
147+
self::recursiveKeySort($value);
148+
}
149+
}
150+
151+
return ksort($array);
152+
}
135153
}

‎tests/Integration/AbstractTechproductsTestCase.php

+287-177
Large diffs are not rendered by default.

‎tests/Integration/Fixtures/schema9.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ index 190214aebad..7a76a28276a 100644
66
<!-- points to the root document of a block of nested documents. Required for nested
77
document support, may be removed otherwise
88
-->
9-
- <field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
10-
+ <field name="_root_" type="string" indexed="true" stored="true" docValues="false" />
9+
- <field name="_root_" type="string" indexed="true" stored="false" />
10+
+ <field name="_root_" type="string" indexed="true" stored="true" />
1111
+ <fieldType name="_nest_path_" class="solr.NestPathField" />
1212
+ <field name="_nest_path_" type="_nest_path_" />
1313

‎tests/Support/UtilityTest.php

+79
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,83 @@ public function testCompactSolrClassName(string $className, string $expected)
149149
{
150150
$this->assertSame($expected, Utility::compactSolrClassName($className));
151151
}
152+
153+
/**
154+
* @dataProvider recursiveKeySortProvider
155+
*/
156+
public function testRecursiveKeySort(array $array, array $expected)
157+
{
158+
$this->assertTrue(Utility::recursiveKeySort($array));
159+
$this->assertSame($expected, $array);
160+
}
161+
162+
public function recursiveKeySortProvider(): array
163+
{
164+
return [
165+
[
166+
[
167+
'a' => 1,
168+
'c' => 2,
169+
'b' => 3,
170+
],
171+
[
172+
'a' => 1,
173+
'b' => 3,
174+
'c' => 2,
175+
],
176+
],
177+
[
178+
[
179+
'a' => 1,
180+
'c' => [
181+
'd',
182+
'f',
183+
'e',
184+
],
185+
'b' => [
186+
'g' => 4,
187+
'i' => 5,
188+
'h' => 6,
189+
],
190+
],
191+
[
192+
'a' => 1,
193+
'b' => [
194+
'g' => 4,
195+
'h' => 6,
196+
'i' => 5,
197+
],
198+
'c' => [
199+
'd',
200+
'f',
201+
'e',
202+
],
203+
],
204+
],
205+
[
206+
[
207+
'b' => [
208+
'd' => [
209+
'e' => 1,
210+
'g' => 2,
211+
'f' => 3,
212+
],
213+
'c' => true,
214+
],
215+
'a' => null,
216+
],
217+
[
218+
'a' => null,
219+
'b' => [
220+
'c' => true,
221+
'd' => [
222+
'e' => 1,
223+
'f' => 3,
224+
'g' => 2,
225+
],
226+
],
227+
],
228+
],
229+
];
230+
}
152231
}

0 commit comments

Comments
 (0)
Please sign in to comment.