Completed
Push — add/password-package ( f1b629...635be6 )
by
unknown
228:32 queued 217:37
created

bootstrap.php ➔ get_user_meta()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 3
dl 0
loc 17
rs 9.3888
c 0
b 0
f 0
1
<?php //phpcs:ignore Squiz.Commenting.FileComment.Missing
2
require_once __DIR__ . '/../../vendor/autoload.php';
3
4
// phpcs:disable
5
6
if ( ! function_exists( 'get_current_user_id' ) ) {
7
	/**
8
	 * Mocked get_current_user_id()
9
	 *
10
	 * @return int
11
	 */
12
	function get_current_user_id() {
13
		return 1;
14
	}
15
}
16
17
if ( ! function_exists( 'get_userdata' ) ) {
18
	/**
19
	 * Mock get_userdata()
20
	 *
21
	 * @param int $user_id User ID.
22
	 *
23
	 * @return stdClass
24
	 */
25
	function get_userdata( $user_id ) {
26
		$user_data                = new stdClass();
27
		$user_data->ID            = $user_id;
28
		$user_data->user_email    = '[email protected]';
29
		$user_data->display_name  = 'Test User';
30
		$user_data->user_nicename = 'testuser';
31
32
		return $user_data;
33
	}
34
}
35
36
if ( ! function_exists( 'get_user_meta' ) ) {
37
	/**
38
	 * Mock get_user_meta()
39
	 *
40
	 * @param int    $user_id User ID.
41
	 * @param string $key key.
42
	 * @param bool   $single single.
43
	 *
44
	 * @return array|false|string
45
	 */
46
	function get_user_meta( $user_id, $key = '', $single = false ) {
47
		switch ( $key ) {
48
			case 'first_name':
49
				return 'Test';
50
51
			case 'last_name':
52
				return 'User';
53
54
			case 'nickname':
55
				return 'test';
56
57
			case 'password_history':
58
				return array();
59
			default:
60
				return false;
61
		}
62
	}
63
}
64