@@ -14,6 +14,13 @@ use Tester\Assert;
1414require __DIR__ . '/../bootstrap.php ' ;
1515
1616
17+ function sortParams (array $ params ): array
18+ {
19+ ksort ($ params );
20+ return $ params ;
21+ }
22+
23+
1724trait PersistentParam1
1825{
1926 /** @persistent */
@@ -62,9 +69,13 @@ class TestPresenter extends BasePresenter
6269 $ this ->p2 = 2 ;
6370 $ this ->t1 = 3 ;
6471 $ this ->t2 = 4 ;
65- Assert::same ('/index.php?p2=2&p1=1&t1=3&t2=4&action=default&presenter=Test ' , $ this ->link ('this ' ));
72+ Assert::same (PHP_VERSION_ID < 80500
73+ ? '/index.php?p2=2&p1=1&t1=3&t2=4&action=default&presenter=Test '
74+ : '/index.php?p2=2&t2=4&p1=1&t1=3&action=default&presenter=Test ' , $ this ->link ('this ' ));
6675 Assert::same ('/index.php?p1=1&t1=3&action=default&presenter=Second ' , $ this ->link ('Second: ' ));
67- Assert::same ('/index.php?p1=1&t1=3&t2=4&action=default&presenter=Third ' , $ this ->link ('Third: ' ));
76+ Assert::same (PHP_VERSION_ID < 80500
77+ ? '/index.php?p1=1&t1=3&t2=4&action=default&presenter=Third '
78+ : '/index.php?t2=4&p1=1&t1=3&action=default&presenter=Third ' , $ this ->link ('Third: ' ));
6879
6980 $ this ->p1 = 20 ;
7081 Assert::same ('/index.php?t1=3&action=default&presenter=Second ' , $ this ->link ('Second: ' ));
@@ -105,32 +116,32 @@ class FourthPresenter extends BasePresenter
105116Assert::same ([
106117 'p1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'BasePresenter ' ],
107118 't1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam1 ' ],
108- ], BasePresenter::getReflection ()->getPersistentParams ());
119+ ], sortParams ( BasePresenter::getReflection ()->getPersistentParams () ));
109120
110121Assert::same ([
111- 'p2 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'TestPresenter ' ],
112122 'p1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'BasePresenter ' ],
123+ 'p2 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'TestPresenter ' ],
113124 't1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam1 ' ],
114125 't2 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam2A ' ],
115- ], TestPresenter::getReflection ()->getPersistentParams ());
126+ ], sortParams ( TestPresenter::getReflection ()->getPersistentParams () ));
116127
117128Assert::same ([
118129 'p1 ' => ['def ' => 20 , 'type ' => 'int ' , 'since ' => 'BasePresenter ' ],
119130 'p3 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'SecondPresenter ' ],
120131 't1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam1 ' ],
121132 't3 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam3 ' ],
122- ], SecondPresenter::getReflection ()->getPersistentParams ());
133+ ], sortParams ( SecondPresenter::getReflection ()->getPersistentParams () ));
123134
124135Assert::same ([
125136 'p1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'BasePresenter ' ],
126137 't1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam1 ' ],
127138 't2 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam2A ' ],
128- ], ThirdPresenter::getReflection ()->getPersistentParams ());
139+ ], sortParams ( ThirdPresenter::getReflection ()->getPersistentParams () ));
129140
130141Assert::same ([
131142 'p1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'BasePresenter ' ],
132143 't1 ' => ['def ' => null , 'type ' => 'scalar ' , 'since ' => 'PersistentParam1 ' ],
133- ], FourthPresenter::getReflection ()->getPersistentParams ());
144+ ], sortParams ( FourthPresenter::getReflection ()->getPersistentParams () ));
134145
135146$ url = new Http \UrlScript ('http://localhost/index.php ' , '/index.php ' );
136147
0 commit comments