File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Retrieve
1313{
1414 private int $ countPages = 1 ;
1515
16- private const URL = 'https://www.bsi.bund.de/EN/Themen/Unternehmen-und-Organisationen/Standards-und-Zertifizierung/Zertifizierung-und-Anerkennung/Listen/Zertifizierte-Produkte-nach-TR/Technische_Sicherheitseinrichtungen/TSE_node.html?gts=913608_list%253DdateOfRevision_dt %252Bdesc>p=913608_list%253D ' ;
16+ private const URL = 'https://www.bsi.bund.de/EN/Themen/Unternehmen-und-Organisationen/Standards-und-Zertifizierung/Zertifizierung-und-Anerkennung/Listen/Zertifizierte-Produkte-nach-TR/Technische_Sicherheitseinrichtungen/TSE_node.html?gts=913608_list%253Dtitle_text_sort %252Bdesc>p=913608_list%253D ' ;
1717
1818 /**
1919 * @var array<string, array<string, string>>
@@ -33,6 +33,8 @@ public function run(): void
3333 $ this ->page ($ page );
3434 $ page ++;
3535 }
36+
37+ krsort ($ this ->retrieved , SORT_NATURAL );
3638 }
3739
3840 public function page (int $ no = 1 ): void
Original file line number Diff line number Diff line change 5050 unlink ($ path );
5151 }
5252});
53+
54+ it ('retrieve and check the retrieved keys are in descending order ' , function () use (&$ retrieve ) {
55+ $ list = $ retrieve ->list ();
56+ $ keys = array_keys ($ list );
57+
58+ $ sorted = $ keys ;
59+ arsort ($ sorted , SORT_NATURAL );
60+
61+ /** @noinspection JsonEncodingApiUsageInspection */
62+ expect ($ keys )->toBe ($ sorted )
63+ ->and (count ($ keys ))->toBe (count ($ sorted ))
64+ ->and (array_values ($ keys ))->toBe (array_values ($ sorted ))
65+ ->and (json_encode ($ keys ))->toBe (json_encode ($ sorted ));
66+ });
You can’t perform that action at this time.
0 commit comments