diff --git a/tests/framework/factories/class-sensei-factory.php b/tests/framework/factories/class-sensei-factory.php index 74c798ba3c..b449bd198c 100644 --- a/tests/framework/factories/class-sensei-factory.php +++ b/tests/framework/factories/class-sensei-factory.php @@ -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 ) { @@ -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 ) { @@ -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(); } diff --git a/tests/framework/factories/class-wp-unittest-factory-for-question.php b/tests/framework/factories/class-wp-unittest-factory-for-question.php index d575e7fe57..a1785fe86e 100644 --- a/tests/framework/factories/class-wp-unittest-factory-for-question.php +++ b/tests/framework/factories/class-wp-unittest-factory-for-question.php @@ -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' => '', diff --git a/tests/unit-tests/test-class-quiz.php b/tests/unit-tests/test-class-quiz.php index 7f4b8d923a..8a32d85331 100644 --- a/tests/unit-tests/test-class-quiz.php +++ b/tests/unit-tests/test-class-quiz.php @@ -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' => '',