@@ -43,8 +43,9 @@ public function testDisplay(): void {
4343
4444 $ viewContext ->model = $ this ->getModelA ('Hello, world! ' );
4545
46- Model::display ('index ' , 'text ' , 'Program ' , 'The program name. ' );
47- Model::display ('index ' , 'number ' , 'Lines ' , 'The lines of program code. ' );
46+ Model::use ('. ' , 'test ' );
47+ Model::display ('test ' , 'text ' , 'Program ' , 'The program name. ' );
48+ Model::display ('test ' , 'number ' , 'Lines ' , 'The lines of program code. ' );
4849
4950 $ this ->makeActionState ($ viewContext );
5051
@@ -63,8 +64,9 @@ public function testDisplay(): void {
6364
6465 $ viewContext ->model = $ this ->getModelB (null , 'Hello, world! ' );
6566
66- Model::display ('index ' , array ('a ' , 'text ' ), 'Program ' , 'The program name. ' );
67- Model::display ('index ' , array ('a ' , 'number ' ), 'Lines ' , 'The lines of program code. ' );
67+ Model::use ('. ' , 'test ' );
68+ Model::display ('test ' , array ('a ' , 'text ' ), 'Program ' , 'The program name. ' );
69+ Model::display ('test ' , array ('a ' , 'number ' ), 'Lines ' , 'The lines of program code. ' );
6870
6971 $ this ->makeActionState ($ viewContext );
7072
@@ -83,8 +85,9 @@ public function testValidationSummary(): void {
8385
8486 $ viewContext ->model = $ this ->getModelA ();
8587
86- Model::required ('justModel ' , 'text ' );
87- Model::validation ('justModel ' , 'number ' , function ($ value , &$ errorMessage ) {
88+ Model::use ('. ' , 'test ' );
89+ Model::required ('test ' , 'text ' );
90+ Model::validation ('test ' , 'number ' , function ($ value , &$ errorMessage ) {
8891 if ($ value != 555 ) {
8992 $ errorMessage = '555 is expected. ' ;
9093 return false ;
@@ -116,8 +119,9 @@ public function testValidationSummary(): void {
116119
117120 $ viewContext = $ this ->setContext ('justModel ' , 'Home ' , 'POST ' , array ('text ' => '' , 'number ' => 555 ));
118121
119- Model::required ('justModel ' , 'text ' );
120- Model::validation ('justModel ' , 'number ' , function ($ value , &$ errorMessage ) {
122+ Model::use ('. ' , 'test ' );
123+ Model::required ('test ' , 'text ' );
124+ Model::validation ('test ' , 'number ' , function ($ value , &$ errorMessage ) {
121125 if ($ value != 555 ) {
122126 $ errorMessage = '555 is expected. ' ;
123127 return false ;
@@ -126,7 +130,7 @@ public function testValidationSummary(): void {
126130 return true ;
127131 });
128132
129- Model::display ('justModel ' , 'text ' , 'Program name ' );
133+ Model::display ('test ' , 'text ' , 'Program name ' );
130134
131135 $ this ->makeActionState ($ viewContext );
132136 $ this ->annotateAndValidateModel ($ viewContext ->getModelState ());
@@ -139,8 +143,9 @@ public function testValidationSummary(): void {
139143
140144 $ viewContext = $ this ->setContext ('justModel ' , 'Home ' , 'POST ' , array ('text ' => 'Hello, world! ' , 'number ' => 555 ));
141145
142- Model::required ('justModel ' , 'text ' );
143- Model::required ('justModel ' , 'number ' );
146+ Model::use ('. ' , 'test ' );
147+ Model::required ('test ' , 'text ' );
148+ Model::required ('test ' , 'number ' );
144149
145150 $ this ->makeActionState ($ viewContext );
146151 $ this ->annotateAndValidateModel ($ viewContext ->getModelState ());
@@ -156,8 +161,9 @@ public function testValidationSummary(): void {
156161 $ viewContext ->model = $ this ->getModelB ();
157162 $ viewContext ->model ->a ->number = 123 ;
158163
159- Model::required ('justModel ' , array ('a ' , 'text ' ));
160- Model::validation ('justModel ' , array ('a ' , 'number ' ), function ($ value , &$ errorMessage ) {
164+ Model::use ('. ' , 'test ' );
165+ Model::required ('test ' , array ('a ' , 'text ' ));
166+ Model::validation ('test ' , array ('a ' , 'number ' ), function ($ value , &$ errorMessage ) {
161167 if ($ value != 555 ) {
162168 $ errorMessage = '555 is expected. ' ;
163169 return false ;
@@ -166,7 +172,7 @@ public function testValidationSummary(): void {
166172 return true ;
167173 });
168174
169- Model::display ('justModel ' , array ('a ' , 'text ' ), 'Test text ' );
175+ Model::display ('test ' , array ('a ' , 'text ' ), 'Test text ' );
170176
171177 $ this ->makeActionState ($ viewContext );
172178 $ this ->annotateAndValidateModel ($ viewContext ->getModelState ());
@@ -183,8 +189,9 @@ public function testValidationMessage(): void {
183189
184190 $ viewContext ->model = $ this ->getModelA ();
185191
186- Model::required ('justModel ' , 'text ' );
187- Model::validation ('justModel ' , 'number ' , function ($ value , &$ errorMessage ) {
192+ Model::use ('. ' , 'test ' );
193+ Model::required ('test ' , 'text ' );
194+ Model::validation ('test ' , 'number ' , function ($ value , &$ errorMessage ) {
188195 if ($ value != 555 ) {
189196 $ errorMessage = '555 is expected. ' ;
190197 return false ;
@@ -220,8 +227,9 @@ public function testValidationMessage(): void {
220227 $ viewContext ->model ->b1 = new ModelB ();
221228 $ viewContext ->model ->b1 ->a = new ModelA ();
222229
223- Model::required ('justModel ' , array ('b1 ' , 'a ' , 'text ' ));
224- Model::validation ('justModel ' , array ('b1 ' , 'a ' , 'number ' ), function ($ value , &$ errorMessage ) {
230+ Model::use ('. ' , 'test ' );
231+ Model::required ('test ' , array ('b1 ' , 'a ' , 'text ' ));
232+ Model::validation ('test ' , array ('b1 ' , 'a ' , 'number ' ), function ($ value , &$ errorMessage ) {
225233 if ($ value != 555 ) {
226234 $ errorMessage = '555 is expected. ' ;
227235 return false ;
@@ -259,8 +267,9 @@ public function testValidationMessage(): void {
259267 $ viewContext ->model ->b1 ->a ->text = 'hello, world! ' ;
260268 $ viewContext ->model ->b1 ->a ->number = 555 ;
261269
262- Model::required ('justModel ' , array ('b1 ' , 'a ' , 'text ' ));
263- Model::validation ('justModel ' , array ('b1 ' , 'a ' , 'number ' ), function ($ value , &$ errorMessage ) {
270+ Model::use ('. ' , 'test ' );
271+ Model::required ('test ' , array ('b1 ' , 'a ' , 'text ' ));
272+ Model::validation ('test ' , array ('b1 ' , 'a ' , 'number ' ), function ($ value , &$ errorMessage ) {
264273 if ($ value != 555 ) {
265274 $ errorMessage = '555 is expected. ' ;
266275 return false ;
@@ -290,7 +299,7 @@ public function testAction() {
290299 $ this ->assertEquals ('/home/page ' , $ action );
291300
292301 $ action = Html::action ('index ' );
293- $ this ->assertEquals ('/home ' , $ action );
302+ $ this ->assertEquals ('/ ' , $ action );
294303
295304 $ action = Html::action ('Index ' , 'Forum ' );
296305 $ this ->assertEquals ('/forum ' , $ action );
@@ -325,7 +334,7 @@ public function testActionLink() {
325334 $ this ->assertEquals ('<a href="/home/page">link</a> ' , $ action );
326335
327336 $ action = Html::actionLink ('home ' , 'index ' );
328- $ this ->assertEquals ('<a href="/home ">home</a> ' , $ action );
337+ $ this ->assertEquals ('<a href="/">home</a> ' , $ action );
329338
330339 $ action = Html::actionLink ('forum ' , 'Index ' , 'Forum ' );
331340 $ this ->assertEquals ('<a href="/forum">forum</a> ' , $ action );
@@ -1452,6 +1461,7 @@ private function setContext($actionName = 'index', $controllerName = 'Home', $me
14521461 }
14531462
14541463 private function resetModel () {
1464+ InternalHelper::setStaticPropertyValue ('\\PhpMvc \\Model ' , 'modelType ' , null );
14551465 InternalHelper::setStaticPropertyValue ('\\PhpMvc \\Model ' , 'annotations ' , array ());
14561466 }
14571467
0 commit comments