Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplifying test using wp_generate_password instead of custom random …
…string generator
  • Loading branch information
manuelRod committed Mar 16, 2022
commit b6a1949fa6a0c61422a03a309b14931d94e03b73
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function test_perflab_aao_autoloaded_options_size() {
* @param int $bytes bytes to load in options.
*/
public static function set_autoloaded_option( $bytes = 800000 ) {
$heavy_option_string = self::random_string_generator( $bytes );
$heavy_option_string = wp_generate_password( $bytes );
add_option( self::AUTOLOADED_OPTION_KEY, $heavy_option_string );
}

Expand All @@ -75,22 +75,6 @@ public static function delete_autoloaded_option() {
delete_option( self::AUTOLOADED_OPTION_KEY );
}

/**
* Generate random string with certain $length.
*
* @param int $length Length ( in bytes ) of string to create.
* @return string
*/
protected static function random_string_generator( $length ) {
$seed = 'abcd123';
$length_seed = strlen( $seed );
$string = '';
for ( $x = 0; $x < $length; $x++ ) {
$string .= $seed[ rand( 0, $length_seed - 1 ) ];
}
return $string;
}

/**
* This is the information we are adding into site_status_tests hook.
*
Expand Down