Skip to content

Commit

Permalink
Revert "Update test file comments"
Browse files Browse the repository at this point in the history
This reverts commit b255638.
  • Loading branch information
Imran92 committed Sep 4, 2024
1 parent b255638 commit aeb0008
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
6 changes: 2 additions & 4 deletions includes/class-sensei-lesson.php
Original file line number Diff line number Diff line change
Expand Up @@ -5061,8 +5061,6 @@ public static function footer_quiz_call_to_action( $lesson_id = 0, $user_id = 0
* @return bool
*/
public static function should_show_lesson_actions( int $lesson_id, int $user_id = 0 ): bool {
$show_actions = true;

$user_id = empty( $user_id ) ? get_current_user_id() : $user_id;

$lesson_prerequisite = (int) get_post_meta( $lesson_id, '_lesson_prerequisite', true );
Expand All @@ -5071,12 +5069,12 @@ public static function should_show_lesson_actions( int $lesson_id, int $user_id

// If the user hasn't completed the prerequisites then hide the current actions.
// (If the user is either the lesson creator or admin, show actions).
$show_actions = Sensei_Utils::user_completed_lesson( $lesson_prerequisite, $user_id )
return Sensei_Utils::user_completed_lesson( $lesson_prerequisite, $user_id )
|| Sensei()->lesson->is_lesson_author( $lesson_id, $user_id )
|| current_user_can( 'manage_options' );
}

return apply_filter( 'sensei_should_show_lesson_actions', $show_actions );
return true;
}

/**
Expand Down
15 changes: 4 additions & 11 deletions tests/unit-tests/blocks/course-theme/test-class-quiz-actions.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<?php

/**
* This file contains the Quiz_Actions_Test class.
* Class Quiz_Actions_Test
*
* @package sensei
* @package Sensei
*/

use Sensei\Blocks\Course_Theme\Quiz_Actions;

/**
* Tests for Quiz_Actions class.
* @covers Sensei\Blocks\Course_Theme\Quiz_Actions
*/
class Quiz_Actions_Test extends WP_UnitTestCase {

use Sensei_Course_Enrolment_Test_Helpers;
Expand Down Expand Up @@ -94,9 +87,9 @@ public function testRender_WhenPaginationIsShown_AlwaysRendersQuizCompleteButton
Sensei_Quiz::start_quiz_questions_loop();

/* Act */
$result_for_other_pages = ( new Quiz_Actions() )->render();
$result_for_other_pages = ( new \Sensei\Blocks\Course_Theme\Quiz_Actions() )->render();
$sensei_question_loop['current_page'] = $sensei_question_loop['total_pages'];
$result_for_last_page = ( new Quiz_Actions() )->render();
$result_for_last_page = ( new \Sensei\Blocks\Course_Theme\Quiz_Actions() )->render();

/* Assert */
$this->assertStringContainsString( 'sensei-item-no-display', $result_for_other_pages );
Expand Down

0 comments on commit aeb0008

Please sign in to comment.