Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing rand() by wp_rand() #7688

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions tests/framework/factories/class-sensei-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public function generate_user_quiz_answers( $quiz_id ) {
if ( 'multiple-choice' == $type ) {
// these answer can be found the question generate and attach answers function
$question_meta = get_post_meta( $question->ID );
$user_quiz_answers[ $question->ID ] = array( 0 => 'wrong1' . rand() );
$user_quiz_answers[ $question->ID ] = array( 0 => 'wrong1' . wp_rand() );

} elseif ( 'boolean' == $type ) {

Expand All @@ -487,15 +487,15 @@ public function generate_user_quiz_answers( $quiz_id ) {

} elseif ( 'single-line' == $type ) {

$user_quiz_answers[ $question->ID ] = 'Single line answer for basic testing ' . rand();
$user_quiz_answers[ $question->ID ] = 'Single line answer for basic testing ' . wp_rand();

} elseif ( 'gap-fill' == $type ) {

$user_quiz_answers[ $question->ID ] = 'OneWordScentencesForSampleAnswer ' . rand();
$user_quiz_answers[ $question->ID ] = 'OneWordScentencesForSampleAnswer ' . wp_rand();

} elseif ( 'multi-line' == $type ) {

$user_quiz_answers[ $question->ID ] = 'Sample paragraph to test the answer ' . rand();
$user_quiz_answers[ $question->ID ] = 'Sample paragraph to test the answer ' . wp_rand();

} elseif ( 'file-upload' == $type ) {

Expand Down Expand Up @@ -798,7 +798,7 @@ public function generate_user_answers_feedback( $quiz_id ) {

foreach ( $answers as $question_id => $answer ) {

$answers_feedback[ $question_id ] = 'Sample Feedback ' . rand();
$answers_feedback[ $question_id ] = 'Sample Feedback ' . wp_rand();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function get_sample_question_data( $type ) {
'question_type' => $type,
'question_category' => 'undefined',
'action' => 'add',
'question' => 'Is this a sample' . $type . ' question ? _ ' . rand(),
'question' => 'Is this a sample' . $type . ' question ? _ ' . wp_rand(),
'question_grade' => '1',
'answer_feedback' => 'Answer Feedback sample ' . rand(),
'answer_feedback' => 'Answer Feedback sample ' . wp_rand(),
'question_description' => ' Basic description for the question',
'question_media' => '',
'answer_order' => '',
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-tests/test-class-quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ public function testSaveUserAnswersUniquelyPerQuiz() {
'question_type' => 'single-line',
'question_category' => 'undefined',
'action' => 'add',
'question' => 'Is this a sample' . 'single-line' . ' question ? _ ' . rand(),
'question' => 'Is this a sample' . 'single-line' . ' question ? _ ' . wp_rand(),
'question_grade' => '1',
'answer_feedback' => 'Answer Feedback sample ' . rand(),
'answer_feedback' => 'Answer Feedback sample ' . wp_rand(),
'question_description' => ' Basic description for the question',
'question_media' => '',
'answer_order' => '',
Expand Down
Loading