Added a Docker-based fresh WordPress integration test

This commit is contained in:
2026-05-31 13:15:43 +03:30
parent 2703e956da
commit 6419f82ea5
7 changed files with 422 additions and 4 deletions
@@ -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
View File
@@ -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();
}
}