- Total
-
-
-
70.51% covered (warning)
+
Total
+
+
+ 0.00% covered (danger)
-
70.51%
-
55 / 78
+
0.00%
+
0 / 78
-
-
33.33% covered (danger)
+
+ 0.00% covered (danger)
-
33.33%
-
1 / 3
+
0.00%
+
0 / 3
CRAP
- Login
-
-
-
70.51% covered (warning)
+
Login
+
+
+ 0.00% covered (danger)
-
70.51%
-
55 / 78
+
0.00%
+
0 / 78
-
-
33.33% covered (danger)
+
+ 0.00% covered (danger)
-
33.33%
-
1 / 3
-
28.26
+
0.00%
+
0 / 3
+
380
0.00% covered (danger)
@@ -102,37 +102,37 @@
- __construct
-
-
-
100.00% covered (success)
+
__construct
+
+
+ 0.00% covered (danger)
-
100.00%
-
4 / 4
-
-
-
100.00% covered (success)
+
0.00%
+
0 / 4
+
+
+ 0.00% covered (danger)
-
100.00%
-
1 / 1
-
1
-
+
0.00%
+
0 / 1
+
2
+
- process
-
-
-
70.00% covered (warning)
+
process
+
+
+ 0.00% covered (danger)
-
70.00%
-
42 / 60
+
0.00%
+
0 / 60
0.00% covered (danger)
@@ -141,20 +141,20 @@
0.00%
0 / 1
-
15.89
+
156
- maybe_redirect
-
-
-
64.29% covered (warning)
+
maybe_redirect
+
+
+ 0.00% covered (danger)
-
64.29%
-
9 / 14
+
0.00%
+
0 / 14
0.00% covered (danger)
@@ -163,7 +163,7 @@
0.00%
0 / 1
-
7.64
+
42
@@ -238,12 +238,12 @@
63
64
65 public function __construct ( API_Interface $api , Settings_Interface $settings , LoggerInterface $logger , ? User_Finder_Factory $user_finder_factory = null ) {
- 66 $this -> setLogger ( $logger ) ;
+ 66 $this -> setLogger ( $logger ) ;
67
- 68 $this -> settings = $settings ;
- 69 $this -> api = $api ;
+ 68 $this -> settings = $settings ;
+ 69 $this -> api = $api ;
70
- 71 $this -> user_finder_factory = $user_finder_factory ?? new User_Finder_Factory ( $this -> api , $this -> settings , $this -> logger ) ;
+ 71 $this -> user_finder_factory = $user_finder_factory ?? new User_Finder_Factory ( $this -> api , $this -> settings , $this -> logger ) ;
72 }
73
74
@@ -256,39 +256,39 @@
81
82 public function process ( $user_id ) {
83
- 84 remove_action ( 'determine_current_user' , array ( $this , 'process' ) , 30 ) ;
+ 84 remove_action ( 'determine_current_user' , array ( $this , 'process' ) , 30 ) ;
85
86
87
- 88 if ( $user_id || empty ( $_GET ) ) {
- 89 return $user_id ;
+ 88 if ( $user_id || empty ( $_GET ) ) {
+ 89 return $user_id ;
90 }
91
92
93
94
- 95 $user_agent = filter_input ( INPUT_SERVER , 'HTTP_USER_AGENT' ) ?? '' ;
- 96 $bot = false !== strpos ( $user_agent , 'bot' ) ;
- 97 if ( $bot ) {
+ 95 $user_agent = filter_input ( INPUT_SERVER , 'HTTP_USER_AGENT' ) ?? '' ;
+ 96 $bot = false !== strpos ( $user_agent , 'bot' ) ;
+ 97 if ( $bot ) {
98 return $user_id ;
99 }
100
101
102
103
- 104 $user_finder = $this -> user_finder_factory -> get_user_finder ( ) ;
+ 104 $user_finder = $this -> user_finder_factory -> get_user_finder ( ) ;
105
- 106 if ( is_null ( $user_finder ) ) {
+ 106 if ( is_null ( $user_finder ) ) {
107
108 return $user_id ;
109 }
110
- 111 $user_array = $user_finder -> get_wp_user_array ( ) ;
+ 111 $user_array = $user_finder -> get_wp_user_array ( ) ;
112
- 113 if ( isset ( $user_array [ 'wp_user' ] ) && $user_array [ 'wp_user' ] instanceof WP_User ) {
- 114 $this -> logger -> debug ( " Found `wp_user: { $user_array [ 'wp_user' ] -> ID } `. " ) ;
- 115 $wp_user = $user_array [ 'wp_user' ] ;
- 116 $user_id = $wp_user -> ID ;
+ 113 if ( isset ( $user_array [ 'wp_user' ] ) && $user_array [ 'wp_user' ] instanceof WP_User ) {
+ 114 $this -> logger -> debug ( " Found `wp_user: { $user_array [ 'wp_user' ] -> ID } `. " ) ;
+ 115 $wp_user = $user_array [ 'wp_user' ] ;
+ 116 $user_id = $wp_user -> ID ;
117 } elseif ( ! empty ( $user_array [ 'user_data' ] ) ) {
118
119 $this -> logger -> debug ( 'No wp_user found, preloading WooCommerce fields.' , $user_array ) ;
@@ -307,20 +307,20 @@
132 return $user_id ;
133 }
134
- 135 $ip_address = $this -> api -> get_ip_address ( ) ;
+ 135 $ip_address = $this -> api -> get_ip_address ( ) ;
136
- 137 if ( empty ( $ip_address ) ) {
+ 137 if ( empty ( $ip_address ) ) {
138
139 return $user_id ;
140 }
141
142
- 143 if ( ! $this -> api -> should_allow_login_attempt ( " ip: { $ip_address } " ) ) {
+ 143 if ( ! $this -> api -> should_allow_login_attempt ( " ip: { $ip_address } " ) ) {
144 return $user_id ;
145 }
146
147
- 148 if ( ! $this -> api -> should_allow_login_attempt ( " wp_user: { $wp_user -> ID } " ) ) {
+ 148 if ( ! $this -> api -> should_allow_login_attempt ( " wp_user: { $wp_user -> ID } " ) ) {
149 return $user_id ;
150 }
151
@@ -332,38 +332,38 @@
157
158
159
- 160 add_action (
- 161 'set_auth_cookie' ,
- 162 function ( $auth_cookie ) {
- 163 global $_COOKIE ;
- 164 $_COOKIE [ AUTH_COOKIE ] = $auth_cookie ;
- 165 $_COOKIE [ SECURE_AUTH_COOKIE ] = $auth_cookie ;
- 166 }
- 167 ) ;
+ 160 add_action (
+ 161 'set_auth_cookie' ,
+ 162 function ( $auth_cookie ) {
+ 163 global $_COOKIE ;
+ 164 $_COOKIE [ AUTH_COOKIE ] = $auth_cookie ;
+ 165 $_COOKIE [ SECURE_AUTH_COOKIE ] = $auth_cookie ;
+ 166 }
+ 167 ) ;
168
- 169 add_action (
- 170 'set_logged_in_cookie' ,
- 171 function ( $logged_in_cookie ) {
- 172 global $_COOKIE ;
- 173 $_COOKIE [ LOGGED_IN_COOKIE ] = $logged_in_cookie ;
- 174 }
- 175 ) ;
+ 169 add_action (
+ 170 'set_logged_in_cookie' ,
+ 171 function ( $logged_in_cookie ) {
+ 172 global $_COOKIE ;
+ 173 $_COOKIE [ LOGGED_IN_COOKIE ] = $logged_in_cookie ;
+ 174 }
+ 175 ) ;
176
177
- 178 wp_set_current_user ( $wp_user -> ID , $wp_user -> user_login ) ;
- 179 wp_set_auth_cookie ( $wp_user -> ID ) ;
- 180 add_action (
- 181 'init' ,
- 182 function ( ) use ( $wp_user ) {
+ 178 wp_set_current_user ( $wp_user -> ID , $wp_user -> user_login ) ;
+ 179 wp_set_auth_cookie ( $wp_user -> ID ) ;
+ 180 add_action (
+ 181 'init' ,
+ 182 function ( ) use ( $wp_user ) {
183 do_action ( 'wp_login' , $wp_user -> user_login , $wp_user ) ;
- 184 }
- 185 ) ;
+ 184 }
+ 185 ) ;
186
- 187 $this -> logger -> info ( " User wp_user: { $wp_user -> ID } logged in via { $user_array [ 'source' ] } . " ) ;
+ 187 $this -> logger -> info ( " User wp_user: { $wp_user -> ID } logged in via { $user_array [ 'source' ] } . " ) ;
188
- 189 $this -> maybe_redirect ( ) ;
+ 189 $this -> maybe_redirect ( ) ;
190
- 191 return $user_id ;
+ 191 return $user_id ;
192 }
193
194
@@ -371,36 +371,36 @@
196
197 protected function maybe_redirect ( ) : void {
198
- 199 if ( ! isset ( $_SERVER [ 'REQUEST_URI' ] ) ) {
+ 199 if ( ! isset ( $_SERVER [ 'REQUEST_URI' ] ) ) {
200
201 return ;
202 }
203
- 204 $request_uri = esc_url_raw ( wp_unslash ( $_SERVER [ 'REQUEST_URI' ] ) ) ;
+ 204 $request_uri = esc_url_raw ( wp_unslash ( $_SERVER [ 'REQUEST_URI' ] ) ) ;
205
206
- 207 $wp_login_endpoint = str_replace ( get_site_url ( ) , '' , wp_login_url ( ) ) ;
- 208 if ( ! stristr ( $request_uri , $wp_login_endpoint ) ) {
+ 207 $wp_login_endpoint = str_replace ( get_site_url ( ) , '' , wp_login_url ( ) ) ;
+ 208 if ( ! stristr ( $request_uri , $wp_login_endpoint ) ) {
209 return ;
210 }
211
212
213
214
- 215 if ( isset ( $_GET [ 'redirect_to' ] ) ) {
+ 215 if ( isset ( $_GET [ 'redirect_to' ] ) ) {
216
- 217 $url = filter_var ( wp_unslash ( $_GET [ 'redirect_to' ] ) , FILTER_SANITIZE_STRING ) ;
- 218 if ( false === $url ) {
+ 217 $url = filter_var ( wp_unslash ( $_GET [ 'redirect_to' ] ) , FILTER_SANITIZE_STRING ) ;
+ 218 if ( false === $url ) {
219 return ;
220 }
- 221 $redirect_to = urldecode ( $url ) ;
+ 221 $redirect_to = urldecode ( $url ) ;
222
223 } else {
224
225 $redirect_to = get_site_url ( ) ;
226 }
227
- 228 if ( wp_safe_redirect ( $redirect_to ) ) {
+ 228 if ( wp_safe_redirect ( $redirect_to ) ) {
229 exit ( ) ;
230 }
231 }
@@ -415,7 +415,7 @@
Legend
Covered by small (and larger) tests Covered by medium (and large) tests Covered by large tests (and tests of unknown size) Not covered Not coverable
- Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 19:36:15 UTC 2024.
+ Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 21:40:06 UTC 2024.
diff --git a/phpunit/src/wp-includes/class-rest-api.php.html b/phpunit/src/wp-includes/class-rest-api.php.html
index f46fb04..a2f6580 100644
--- a/phpunit/src/wp-includes/class-rest-api.php.html
+++ b/phpunit/src/wp-includes/class-rest-api.php.html
@@ -462,7 +462,7 @@
Legend
Covered by small (and larger) tests Covered by medium (and large) tests Covered by large tests (and tests of unknown size) Not covered Not coverable
- Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 19:36:15 UTC 2024.
+ Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 21:40:06 UTC 2024.
diff --git a/phpunit/src/wp-includes/class-wp-mail.php.html b/phpunit/src/wp-includes/class-wp-mail.php.html
index 732f02b..e3f811e 100644
--- a/phpunit/src/wp-includes/class-wp-mail.php.html
+++ b/phpunit/src/wp-includes/class-wp-mail.php.html
@@ -313,7 +313,7 @@
Legend
Covered by small (and larger) tests Covered by medium (and large) tests Covered by large tests (and tests of unknown size) Not covered Not coverable
- Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 19:36:15 UTC 2024.
+ Generated by php-code-coverage 9.2.31 using PHP 7.4.33 at Sun May 26 21:40:06 UTC 2024.
diff --git a/phpunit/src/wp-includes/dashboard.html b/phpunit/src/wp-includes/dashboard.html
index fbb6b41..1696cd3 100644
--- a/phpunit/src/wp-includes/dashboard.html
+++ b/phpunit/src/wp-includes/dashboard.html
@@ -60,8 +60,8 @@ Insufficient Coverage
BrianHenryIE\WP_Autologin_URLs\WP_Includes\CLI 0%
+ BrianHenryIE\WP_Autologin_URLs\WP_Includes\Login 0%
BrianHenryIE\WP_Autologin_URLs\WP_Includes\REST_API 0%
- BrianHenryIE\WP_Autologin_URLs\WP_Includes\Login 70%
BrianHenryIE\WP_Autologin_URLs\WP_Includes\WP_Mail 75%
@@ -79,9 +79,9 @@ Project Risks
+ BrianHenryIE\WP_Autologin_URLs\WP_Includes\Login 380
BrianHenryIE\WP_Autologin_URLs\WP_Includes\REST_API 272
BrianHenryIE\WP_Autologin_URLs\WP_Includes\CLI 90
- BrianHenryIE\WP_Autologin_URLs\WP_Includes\Login 28
BrianHenryIE\WP_Autologin_URLs\WP_Includes\WP_Mail 19
@@ -123,6 +123,9 @@ Insufficient Coverage
__construct 0%
add_autologin_to_url 0%
send_magic_link 0%
+ __construct 0%
+ process 0%
+ maybe_redirect 0%
__construct 0%
register_routes 0%
create_item 0%
@@ -130,8 +133,6 @@ Insufficient Coverage
prepare_item_for_response 0%
get_item_schema 0%
get_args_schema 0%
- maybe_redirect 64%
- process 70%
add_autologin_links_to_email 74%
@@ -149,13 +150,13 @@