@@ -142,22 +142,33 @@ public function test_get_all_widgets_all()
142
142
143
143
public function test_get_all_widgets_featured ()
144
144
{
145
+ $ not_featured = $ this ->make_disposable_widget ();
145
146
$ not_in_catalog = $ this ->make_disposable_widget ();
146
147
$ not_playable = $ this ->make_disposable_widget ();
147
148
$ visible [] = $ this ->make_disposable_widget ();
148
149
$ visible [] = $ this ->make_disposable_widget ();
149
150
150
- // this shouldn't show up
151
+ // this shouldn't show up despite featured being true
151
152
$ this ->_as_super_user ();
152
153
$ args = $ this ->sample_widget_update_args ($ not_in_catalog ->id , $ not_in_catalog ->clean_name );
153
154
$ args ->in_catalog = false ;
155
+ $ args ->featured = true ;
154
156
$ msg = \Materia \Widget_Manager::update_widget ($ args );
155
157
156
- // this shouldn't show up
158
+ // this shouldn't show up despite featured being true
157
159
$ args = $ this ->sample_widget_update_args ($ not_playable ->id , $ not_playable ->clean_name );
158
160
$ args ->is_playable = false ;
161
+ $ args ->featured = true ;
159
162
$ msg = \Materia \Widget_Manager::update_widget ($ args );
160
163
164
+ // have to set featured to true for visible widgets, as it is false by default
165
+ foreach ($ visible as $ widget )
166
+ {
167
+ $ args = $ this ->sample_widget_update_args ($ widget ->id , $ widget ->clean_name );
168
+ $ args ->featured = true ;
169
+ $ msg = \Materia \Widget_Manager::update_widget ($ args );
170
+ }
171
+
161
172
$ res = \Materia \Widget_Manager::get_widgets (null , 'featured ' );
162
173
self ::assertCount (2 , $ res );
163
174
@@ -184,7 +195,7 @@ public function test_get_all_widgets_by_id()
184
195
$ args ->is_playable = false ;
185
196
$ msg = \Materia \Widget_Manager::update_widget ($ args );
186
197
187
- $ res = \Materia \Widget_Manager::get_widgets (null , 'featured ' );
198
+ $ res = \Materia \Widget_Manager::get_widgets (null , 'catalog ' );
188
199
self ::assertCount (2 , $ res );
189
200
190
201
self ::assertEquals ($ visible [0 ]->id , $ res [0 ]->id );
@@ -225,6 +236,7 @@ protected function sample_widget_update_args($id=0, $clean_name='clean_name')
225
236
$ args ->id = $ id ;
226
237
$ args ->clean_name = $ clean_name ;
227
238
$ args ->in_catalog = 1 ;
239
+ $ args ->featured = 0 ;
228
240
$ args ->is_editable = 1 ;
229
241
$ args ->is_scorable = 1 ;
230
242
$ args ->is_playable = 1 ;
0 commit comments