1 | <?php |
||
7 | class MockeryWpBridge implements WpBridgeInterface |
||
8 | { |
||
9 | /** |
||
10 | * Mockery instance. |
||
11 | * |
||
12 | * @var \Mockery |
||
13 | */ |
||
14 | private $mock; |
||
15 | |||
16 | /** |
||
17 | * All shortcodes. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | private $shortcodes = []; |
||
22 | |||
23 | /** |
||
24 | * All filters. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | private $filters = []; |
||
29 | |||
30 | /** |
||
31 | * All actions. |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private $actions = []; |
||
36 | |||
37 | /** |
||
38 | * Add a shortcode. |
||
39 | * |
||
40 | * @param string $tag |
||
41 | * |
||
42 | * @param mixed $func |
||
43 | */ |
||
44 | public function addShortcode($tag, $func) |
||
50 | |||
51 | /** |
||
52 | * Check if shortcode exist. |
||
53 | * |
||
54 | * @param string $tag |
||
55 | * |
||
56 | * @return boolean |
||
57 | */ |
||
58 | public function hasShortcode($tag) |
||
62 | |||
63 | /** |
||
64 | * Get a shortcode callback. |
||
65 | * |
||
66 | * @param string $tag |
||
67 | * |
||
68 | * @return mixed |
||
69 | */ |
||
70 | public function getShortcodeCallback($tag) |
||
74 | |||
75 | /** |
||
76 | * Combines shortcode attributes with known attributes and fills in defaults when needed. |
||
77 | * |
||
78 | * @param array $pairs |
||
79 | * @param array $atts |
||
80 | * @param string|null $shortcode |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function shortcodeAtts($pairs, $atts, $shortcode = null) |
||
88 | |||
89 | /* -------- */ |
||
90 | |||
91 | /** |
||
92 | * Wordpress mock on __() func. |
||
93 | * |
||
94 | * @param string $text |
||
95 | * @param string $domain |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | public function __($text, $domain) |
||
103 | |||
104 | /* -------- */ |
||
105 | |||
106 | /** |
||
107 | * Wordpress mock on add_filter func. |
||
108 | * |
||
109 | * @param string $filterName |
||
110 | * @param callback $filterCall |
||
111 | * @param int $prio |
||
112 | * @param int $numVars |
||
113 | * |
||
114 | * @return self |
||
115 | */ |
||
116 | public function addFilter($filterName, $filterCall, $prio, $numVars) |
||
122 | |||
123 | /** |
||
124 | * Get all added filters. |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | public function getAddedFilters() |
||
132 | |||
133 | /** |
||
134 | * Wordpress mock on add_action func. |
||
135 | * |
||
136 | * @param string $filterName |
||
137 | * @param callback $filterCall |
||
138 | * @param int $prio |
||
139 | * @param int $numVars |
||
140 | * |
||
141 | * @return self |
||
142 | */ |
||
143 | public function addAction($filterName, $filterCall, $prio, $numVars) |
||
149 | |||
150 | /** |
||
151 | * Get added actions |
||
152 | * |
||
153 | * @return array |
||
154 | */ |
||
155 | public function getAddedActions() |
||
159 | |||
160 | /** |
||
161 | * add |
||
162 | * |
||
163 | * @param string $filterName |
||
164 | * @param callback $filterCall |
||
165 | * @param int $prio |
||
166 | * @param int $numVars |
||
167 | * |
||
168 | * @return \stdClass |
||
169 | */ |
||
170 | private function add($filterName, $filterCall, $prio, $numVars) |
||
180 | |||
181 | public function __call($function, $args) |
||
185 | |||
186 | public function mock() |
||
194 | } |
||
195 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.