@@ -114,7 +114,7 @@ public function test_is_available_without_permission()
114114
115115 public function test_get_item_id ()
116116 {
117- $ type_data = ['item_id ' => 123 ];
117+ $ type_data = ['idea_id ' => 123 ];
118118 $ this ->assertEquals (123 , status::get_item_id ($ type_data ));
119119 }
120120
@@ -284,70 +284,36 @@ public function test_get_email_template_variables()
284284 $ this ->assertEquals ($ expected , $ result );
285285 }
286286
287- public function test_pre_create_insert_array ()
287+ public function test_create_insert_array ()
288288 {
289- $ type_data = ['idea_id ' => 5 ];
290- $ notify_users = [];
289+ $ type_data = [
290+ 'idea_id ' => 7 ,
291+ 'status ' => 4
292+ ];
291293 $ idea_data = [
292294 'idea_title ' => 'Sample Idea ' ,
293295 'idea_author ' => 3
294296 ];
295297
296298 $ this ->idea_factory ->expects ($ this ->once ())
297299 ->method ('get_idea ' )
298- ->with (5 )
300+ ->with (7 )
299301 ->willReturn ($ idea_data );
300302
301- $ result = $ this ->notification_type ->pre_create_insert_array ($ type_data , $ notify_users );
302-
303- $ expected = [
304- 'idea_title ' => 'Sample Idea ' ,
305- 'idea_author ' => 3
306- ];
307-
308- $ this ->assertEquals ($ expected , $ result );
309- }
310-
311- public function test_pre_create_insert_array_idea_not_found ()
312- {
313- $ type_data = ['idea_id ' => 999 ];
314- $ notify_users = [];
315-
316- $ this ->idea_factory ->expects ($ this ->once ())
317- ->method ('get_idea ' )
318- ->with (999 )
319- ->willReturn (false );
320-
321- $ result = $ this ->notification_type ->pre_create_insert_array ($ type_data , $ notify_users );
322- $ this ->assertEquals ([], $ result );
323- }
324-
325- public function test_create_insert_array ()
326- {
327- $ type_data = [
328- 'item_id ' => 1 ,
329- 'idea_id ' => 7 ,
330- 'status ' => 4
331- ];
332- $ pre_create_data = [
333- 'idea_title ' => 'Another Idea ' ,
334- 'idea_author ' => 8
335- ];
336-
337303 // Use reflection to access set_data calls
338304 $ reflection = new \ReflectionClass ($ this ->notification_type );
339305 $ set_data_method = $ reflection ->getMethod ('set_data ' );
340306 $ set_data_method ->setAccessible (true );
341307
342- $ this ->notification_type ->create_insert_array ($ type_data, $ pre_create_data );
308+ $ this ->notification_type ->create_insert_array ($ type_data );
343309
344310 // Verify data was set by checking get_data
345311 $ get_data_method = $ reflection ->getMethod ('get_data ' );
346312 $ get_data_method ->setAccessible (true );
347313
348314 $ this ->assertEquals (7 , $ get_data_method ->invoke ($ this ->notification_type , 'idea_id ' ));
349315 $ this ->assertEquals (4 , $ get_data_method ->invoke ($ this ->notification_type , 'status ' ));
350- $ this ->assertEquals ('Another Idea ' , $ get_data_method ->invoke ($ this ->notification_type , 'idea_title ' ));
351- $ this ->assertEquals (8 , $ get_data_method ->invoke ($ this ->notification_type , 'idea_author ' ));
316+ $ this ->assertEquals ('Sample Idea ' , $ get_data_method ->invoke ($ this ->notification_type , 'idea_title ' ));
317+ $ this ->assertEquals (3 , $ get_data_method ->invoke ($ this ->notification_type , 'idea_author ' ));
352318 }
353319}
0 commit comments