Benign php 22,872,290 installs Download

php-mock/php-mock 2.6.1

“PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.”

Basename is uppercase README.mdPHP invokes a variable-named function

Evidence

At least four Markdown-style heading lines README.md · lines 3–25
3:63… ilt-in PHP functions like
4`time()` or `rand()`. This is achieved by [PHP's namespace fallback policy](http://php.net/manual/en/language.namespaces.fallback.php):
5
6> PHP will fall back to global functions […]
7> if a namespaced function […] does not exist.
8
9PHP-Mock uses that feature by providing the namespaced function. I.e. you have
10to be in a **non global namespace** context and call the function
11**unqualified**:
12
⋯4 lines
17```
18
19## Requirements and restrictions
20
21* Only *unqualified* function calls in a namespace context can be mocked.
22 E.g. a call for `time()` in the namespace `foo` is mockable,
23 a call for `\time()` is not.
24
25* The mock has to …
Twenty or more Markdown HTTP link spans README.md · lines 25–29
25:61… qualified function
26 in the tested class. This is documented in [Bug #68541](https://bugs.php.net/bug.php?id=68541).
27 In most cases, you can ignore this restriction but if you happen to run into
28 this issue you can call [`Mock::define()`](http://php-mock.github.io/php-mock/api/class-phpmock.Mock.html#_define)
29 before that first call. This would define a side effectless n …
Hardcoded Bitcoin address Deactivatable.php · lines 1–18
⋯5 lines
6 * Implementation deactivates related mocks.
7 *
8 * @author Markus Malkusch <markus@malkusch.de>
9 * @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
10 * @license http://www.wtfpl.net/txt/copying/ WTFPL
11 */
12interface Deactivatable
13{
14 /**
15 * Disable related mocks.
16 */
17 public function disable();
18}
PHP callback dispatcher with argument array Mock.php · lines 131–144
131 public function call(array $arguments)
132 {
133 return call_user_func_array($this->function, $arguments);
134 }
135
136 /**
137 * Returns the fully qualified function name.
138 *
139 * @return string The function name with its namespace.
140 * @internal
141 */
142 public function getFQFN()
143 {
144 return strt …
HTTP URL link tag or example Mock.php · lines 176–188
176:21… ed this method does nothing.
177 *
178 * @see enable()
179 * @link https://bugs.php.net/bug.php?id=68541 Bug #68541
180 */
181 public function define()
182 {
183 $fqfn = $this->getFQFN();
184 if (function_exists($fqfn)) {
185 return;
186 }
187 $functionGenerator = new MockFunctionGenerator($this);
188 $functionGenerator …

Showing the top 5 files — 7 more files (39 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.