@@ -138,17 +138,22 @@ public function testCancelSubscription()
138
138
139
139
public function testParseNotification ()
140
140
{
141
- $ xml = '<notification></notification> ' ;
142
- $ payload = base64_encode ($ xml );
143
- $ signature = \Braintree_Digest::hexDigestSha1 (\Braintree_Configuration::privateKey (), $ payload );
144
- $ gatewayMock = $ this ->buildGatewayMock ($ payload );
145
- $ gateway = new Gateway ($ this ->getHttpClient (), $ this ->getHttpRequest (), $ gatewayMock );
146
- $ params = array (
147
- 'bt_signature ' => $ payload .'| ' .$ signature ,
148
- 'bt_payload ' => $ payload
149
- );
150
- $ request = $ gateway ->parseNotification ($ params );
151
- $ this ->assertInstanceOf ('\Braintree_WebhookNotification ' , $ request );
141
+ /* Webhook notifications need PHP >= 5.4 */
142
+ if (PHP_VERSION >= '5.4 ' ) {
143
+ $ xml = '<notification></notification> ' ;
144
+ $ payload = base64_encode ($ xml );
145
+ $ signature = \Braintree_Digest::hexDigestSha1 (\Braintree_Configuration::privateKey (), $ payload );
146
+ $ gatewayMock = $ this ->buildGatewayMock ($ payload );
147
+ $ gateway = new Gateway ($ this ->getHttpClient (), $ this ->getHttpRequest (), $ gatewayMock );
148
+ $ params = array (
149
+ 'bt_signature ' => $ payload .'| ' .$ signature ,
150
+ 'bt_payload ' => $ payload
151
+ );
152
+ $ request = $ gateway ->parseNotification ($ params );
153
+ $ this ->assertInstanceOf ('\Braintree_WebhookNotification ' , $ request );
154
+ } else {
155
+ $ this ->assertTrue (true );
156
+ }
152
157
}
153
158
154
159
/**
0 commit comments