@@ -138,8 +138,7 @@ public function testCancelSubscription()
138138
139139 public function testParseNotification ()
140140 {
141- /* Webhook notifications need PHP >= 5.4 */
142- if (PHP_VERSION >= '5.4 ' ) {
141+ if (\Braintree_Version::MAJOR >= 3 ) {
143142 $ xml = '<notification></notification> ' ;
144143 $ payload = base64_encode ($ xml );
145144 $ signature = \Braintree_Digest::hexDigestSha1 (\Braintree_Configuration::privateKey (), $ payload );
@@ -152,7 +151,17 @@ public function testParseNotification()
152151 $ request = $ gateway ->parseNotification ($ params );
153152 $ this ->assertInstanceOf ('\Braintree_WebhookNotification ' , $ request );
154153 } else {
155- $ this ->assertTrue (true );
154+ $ xml = '<notification><subject></subject></notification> ' ;
155+ $ payload = base64_encode ($ xml );
156+ $ signature = \Braintree_Digest::hexDigestSha1 (\Braintree_Configuration::privateKey (), $ payload );
157+ $ gatewayMock = $ this ->buildGatewayMock ($ payload );
158+ $ gateway = new Gateway ($ this ->getHttpClient (), $ this ->getHttpRequest (), $ gatewayMock );
159+ $ params = array (
160+ 'bt_signature ' => $ payload .'| ' .$ signature ,
161+ 'bt_payload ' => $ payload
162+ );
163+ $ request = $ gateway ->parseNotification ($ params );
164+ $ this ->assertInstanceOf ('\Braintree_WebhookNotification ' , $ request );
156165 }
157166 }
158167
0 commit comments