@@ -78,6 +78,7 @@ public function testUnwrapWithVerification(): void
7878 {
7979 $ payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"} ' ;
8080 $ secret = 'whsec_c2VjcmV0Cg== ' ;
81+ $ rawSecret = "secret \n" ;
8182 $ webhook = new Webhook ($ secret );
8283 $ messageId = '1 ' ;
8384 $ timestamp = time ();
@@ -89,7 +90,7 @@ public function testUnwrapWithVerification(): void
8990 'webhook-id ' => [$ messageId ],
9091 'webhook-timestamp ' => [(string ) $ timestamp ],
9192 ];
92- $ this ->client ->events ->unwrap ($ payload , $ headers , $ secret );
93+ $ this ->client ->events ->unwrap ($ payload , $ headers , $ rawSecret );
9394 // unwrap successful if not error thrown, increment assertion count to avoid risky test warning
9495 $ this ->addToAssertionCount (1 );
9596 }
@@ -101,6 +102,7 @@ public function testUnwrapWrongKey(): void
101102
102103 $ payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"} ' ;
103104 $ secret = 'whsec_c2VjcmV0Cg== ' ;
105+ $ rawSecret = "secret \n" ;
104106 $ webhook = new Webhook ($ secret );
105107 $ messageId = '1 ' ;
106108 $ timestamp = time ();
@@ -123,6 +125,7 @@ public function testUnwrapBadSignature(): void
123125
124126 $ payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"} ' ;
125127 $ secret = 'whsec_c2VjcmV0Cg== ' ;
128+ $ rawSecret = "secret \n" ;
126129 $ webhook = new Webhook ($ secret );
127130 $ messageId = '1 ' ;
128131 $ timestamp = time ();
@@ -134,7 +137,7 @@ public function testUnwrapBadSignature(): void
134137 'webhook-id ' => [$ messageId ],
135138 'webhook-timestamp ' => [(string ) $ timestamp ],
136139 ];
137- $ this ->client ->events ->unwrap ($ payload , $ headers , $ secret );
140+ $ this ->client ->events ->unwrap ($ payload , $ headers , $ rawSecret );
138141 }
139142
140143 #[Test]
@@ -144,6 +147,7 @@ public function testUnwrapOldTimestamp(): void
144147
145148 $ payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"} ' ;
146149 $ secret = 'whsec_c2VjcmV0Cg== ' ;
150+ $ rawSecret = "secret \n" ;
147151 $ webhook = new Webhook ($ secret );
148152 $ messageId = '1 ' ;
149153 $ timestamp = time ();
@@ -155,7 +159,7 @@ public function testUnwrapOldTimestamp(): void
155159 'webhook-id ' => [$ messageId ],
156160 'webhook-timestamp ' => ['5 ' ],
157161 ];
158- $ this ->client ->events ->unwrap ($ payload , $ headers , $ secret );
162+ $ this ->client ->events ->unwrap ($ payload , $ headers , $ rawSecret );
159163 }
160164
161165 #[Test]
@@ -165,6 +169,7 @@ public function testUnwrapWrongMessageID(): void
165169
166170 $ payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"} ' ;
167171 $ secret = 'whsec_c2VjcmV0Cg== ' ;
172+ $ rawSecret = "secret \n" ;
168173 $ webhook = new Webhook ($ secret );
169174 $ messageId = '1 ' ;
170175 $ timestamp = time ();
@@ -176,6 +181,6 @@ public function testUnwrapWrongMessageID(): void
176181 'webhook-id ' => ['wrong ' ],
177182 'webhook-timestamp ' => [(string ) $ timestamp ],
178183 ];
179- $ this ->client ->events ->unwrap ($ payload , $ headers , $ secret );
184+ $ this ->client ->events ->unwrap ($ payload , $ headers , $ rawSecret );
180185 }
181186}
0 commit comments