Added a Docker-based fresh WordPress integration test
This commit is contained in:
@@ -54,12 +54,13 @@ class AuthenticateController extends InvocableController
|
||||
}
|
||||
$random_password = wp_generate_password(12, true);
|
||||
$username = $identifier_value;
|
||||
$email = $identifier_name === 'email' ? $identifier_value : '';
|
||||
|
||||
if (username_exists($username)) {
|
||||
$username .= '_'.wp_generate_password(4, false);
|
||||
}
|
||||
|
||||
$user_id = wp_create_user($username, $random_password);
|
||||
$user_id = wp_create_user($username, $random_password, $email);
|
||||
|
||||
if (is_wp_error($user_id)) {
|
||||
wp_die(view('invalid-token'), 'Invalid Token', ['response' => 500]);
|
||||
|
||||
+4
-1
@@ -1,10 +1,13 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('view')) {
|
||||
function view(string $view)
|
||||
function view(string $view): string
|
||||
{
|
||||
$basedir = plugin_dir_path(__FILE__);
|
||||
ob_start();
|
||||
include "{$basedir}resources/views/$view.php";
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user