@@ -15,6 +15,7 @@ protected function setUp()
1515 {
1616 $ this ->config = new Bugsnag_Configuration ();
1717 $ this ->config ->apiKey = '6015a72ff14038114c3d12623dfb018f ' ;
18+ $ this ->config ->user = array ('id ' => 'foo ' );
1819 $ this ->config ->beforeNotifyFunction = 'before_notify_skip_error ' ;
1920
2021 $ this ->diagnostics = new Bugsnag_Diagnostics ($ this ->config );
@@ -34,14 +35,22 @@ public function testNotification()
3435 ->getMock ();
3536
3637 // Expect postJSON to be called
37- $ this ->notification ->expects ($ this ->once ())
38- ->method ('postJSON ' )
39- ->with ($ this ->equalTo ('https://notify.bugsnag.com ' ),
40- $ this ->anything ());
38+ $ this ->notification ->expects ($ spy = $ this ->any ())->method ('postJson ' );
4139
4240 // Add an error to the notification and deliver it
4341 $ this ->notification ->addError ($ this ->getError ());
4442 $ this ->notification ->deliver ();
43+
44+ // Check the correct args were passed
45+ $ this ->assertCount (1 , $ invocations = $ spy ->getInvocations ());
46+ $ params = $ invocations [0 ]->parameters ;
47+ $ this ->assertCount (2 , $ params );
48+ $ this ->assertSame ('https://notify.bugsnag.com ' , $ params [0 ]);
49+ $ this ->assertInternalType ('array ' , $ params [1 ]);
50+ $ this ->assertSame ('6015a72ff14038114c3d12623dfb018f ' , $ params [1 ]['apiKey ' ]);
51+ $ this ->assertInternalType ('array ' , $ params [1 ]['notifier ' ]);
52+ $ this ->assertInternalType ('array ' , $ params [1 ]['events ' ]);
53+ $ this ->assertSame (array ('id ' => 'foo ' ), $ params [1 ]['events ' ][0 ]['user ' ]);
4554 }
4655
4756 public function testBeforeNotifySkipsError ()
0 commit comments