@@ 253-271 (lines=19) @@ | ||
250 | * @param string $user_id The user id you want the token to have. |
|
251 | * @return \WP_Error |
|
252 | */ |
|
253 | public function get_sample_error( $error_code, $user_id ) { |
|
254 | ||
255 | $signature_details = array( |
|
256 | 'token' => 'dhj938djh938d:1:' . $user_id, |
|
257 | 'timestamp' => time(), |
|
258 | 'nonce' => 'asd3d32d', |
|
259 | 'body_hash' => 'dsf34frf', |
|
260 | 'method' => 'POST', |
|
261 | 'url' => 'https://example.org', |
|
262 | 'signature' => 'sdf234fe', |
|
263 | ); |
|
264 | ||
265 | return new \WP_Error( |
|
266 | $error_code, |
|
267 | 'An error was triggered', |
|
268 | compact( 'signature_details' ) |
|
269 | ); |
|
270 | ||
271 | } |
|
272 | ||
273 | /** |
|
274 | * Creates a fake error |
@@ 34-52 (lines=19) @@ | ||
31 | * @param string $user_id The user id you want the token to have. |
|
32 | * @return \WP_Error |
|
33 | */ |
|
34 | public function get_sample_error( $error_code, $user_id ) { |
|
35 | ||
36 | $signature_details = array( |
|
37 | 'token' => 'dhj938djh938d:1:' . $user_id, |
|
38 | 'timestamp' => time(), |
|
39 | 'nonce' => 'asd3d32d', |
|
40 | 'body_hash' => 'dsf34frf', |
|
41 | 'method' => 'POST', |
|
42 | 'url' => 'https://example.org', |
|
43 | 'signature' => 'sdf234fe', |
|
44 | ); |
|
45 | ||
46 | return new \WP_Error( |
|
47 | $error_code, |
|
48 | 'An error was triggered', |
|
49 | compact( 'signature_details' ) |
|
50 | ); |
|
51 | ||
52 | } |
|
53 | ||
54 | /** |
|
55 | * Test storing an error |