PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.22
ووسلام – همگام سازی ووکامرس و باسلام v1.10.22
1.10.22 1.10.21 1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 All 55 releases
sync-basalam / tests / Support / JobsRunnerWordPressStubs.php

JobsRunnerWordPressStubs.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.22, at tests/Support/JobsRunnerWordPressStubs.php

134 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!function_exists('add_action')) {
4 function add_action($hookName, $callback, $priority = 10, $acceptedArgs = 1)
5 {
6 $GLOBALS['sync_basalam_jobs_runner_test_state']['actions'][$hookName][] = [
7 'callback' => $callback,
8 'priority' => $priority,
9 'accepted_args' => $acceptedArgs,
10 ];
11
12 return true;
13 }
14 }
15
16 if (!function_exists('did_action')) {
17 function did_action($hookName)
18 {
19 return $GLOBALS['sync_basalam_jobs_runner_test_state']['did_actions'][$hookName] ?? 0;
20 }
21 }
22
23 if (!function_exists('current_filter')) {
24 function current_filter()
25 {
26 return $GLOBALS['sync_basalam_jobs_runner_test_state']['current_filter'] ?? '';
27 }
28 }
29
30 if (!function_exists('fastcgi_finish_request')) {
31 function fastcgi_finish_request()
32 {
33 $GLOBALS['sync_basalam_jobs_runner_test_state']['events'][] = 'fastcgi_finish_request';
34
35 return true;
36 }
37 }
38
39 if (!function_exists('wp_doing_ajax')) {
40 function wp_doing_ajax()
41 {
42 return $GLOBALS['sync_basalam_jobs_runner_test_state']['doing_ajax'] ?? false;
43 }
44 }
45
46 if (!function_exists('wp_unslash')) {
47 function wp_unslash($value)
48 {
49 return is_string($value) ? stripslashes($value) : $value;
50 }
51 }
52
53 if (!function_exists('sanitize_key')) {
54 function sanitize_key($key)
55 {
56 return preg_replace('/[^a-z0-9_\-]/', '', strtolower((string) $key));
57 }
58 }
59
60 if (!function_exists('get_transient')) {
61 function get_transient($transient)
62 {
63 $GLOBALS['sync_basalam_jobs_runner_test_state']['events'][] = 'get_transient';
64 $GLOBALS['sync_basalam_jobs_runner_test_state']['transient_reads'][] = $transient;
65
66 return $GLOBALS['sync_basalam_jobs_runner_test_state']['transients'][$transient] ?? false;
67 }
68 }
69
70 if (!function_exists('set_transient')) {
71 function set_transient($transient, $value, $expiration = 0)
72 {
73 $GLOBALS['sync_basalam_jobs_runner_test_state']['events'][] = 'set_transient';
74 $GLOBALS['sync_basalam_jobs_runner_test_state']['transient_writes'][] = [
75 'name' => $transient,
76 'value' => $value,
77 'expiration' => $expiration,
78 ];
79 $GLOBALS['sync_basalam_jobs_runner_test_state']['transients'][$transient] = $value;
80
81 return true;
82 }
83 }
84
85 if (!function_exists('admin_url')) {
86 function admin_url($path = '')
87 {
88 return 'https://example.test/wp-admin/' . ltrim($path, '/');
89 }
90 }
91
92 if (!function_exists('add_query_arg')) {
93 function add_query_arg($key, $value, $url)
94 {
95 $separator = strpos($url, '?') === false ? '?' : '&';
96
97 return $url . $separator . rawurlencode((string) $key) . '=' . rawurlencode((string) $value);
98 }
99 }
100
101 if (!function_exists('esc_url_raw')) {
102 function esc_url_raw($url)
103 {
104 return $url;
105 }
106 }
107
108 if (!function_exists('wp_create_nonce')) {
109 function wp_create_nonce($action = -1)
110 {
111 return 'test-nonce-for-' . $action;
112 }
113 }
114
115 if (!function_exists('apply_filters')) {
116 function apply_filters($hookName, $value)
117 {
118 return $GLOBALS['sync_basalam_jobs_runner_test_state']['filter_values'][$hookName] ?? $value;
119 }
120 }
121
122 if (!function_exists('wp_remote_post')) {
123 function wp_remote_post($url, $args = [])
124 {
125 $GLOBALS['sync_basalam_jobs_runner_test_state']['events'][] = 'remote_post';
126 $GLOBALS['sync_basalam_jobs_runner_test_state']['remote_requests'][] = [
127 'url' => $url,
128 'args' => $args,
129 ];
130
131 return ['response' => ['code' => 200]];
132 }
133 }
134