Loading modules/course_node/tests/src/Functional/CourseNodeTest.php +1 −1 Changes for modules/course_node/tests/src/Functional/CourseNodeTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class CourseNodeTest extends CourseTestBase { $this->drupalLogin($this->student_user); $this->drupalGet('node/1'); $this->clickLink('Course title 1'); $this->clickLink('Take course'); $this->clickLink('Enroll'); $this->clickLink('Complete'); } Loading src/View/CourseViewBuilder.php +17 −1 Changes for src/View/CourseViewBuilder.php: 17 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,10 +33,26 @@ class CourseViewBuilder extends EntityViewBuilder { } else { // Render take course button. $text = 'Enroll'; // Enrolled. if ($enrollment) { // Completed. if ($enrollment->isComplete()) { $text = 'Review course'; } else { // Not started. $text = 'Take course'; // In progress. if (!empty($enrollment->get('section_name')->getValue())) { $text = 'Resume course'; } } } $build['course'] = [ '#theme' => 'course_take_course_button', '#course' => $course, '#title' => $enrollment && $enrollment->isComplete() ? t('Review course') : t('Take course'), '#title' => $this->t($text), ]; } Loading tests/src/Functional/CourseWorkflowTest.php +1 −1 Changes for tests/src/Functional/CourseWorkflowTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class CourseWorkflowTest extends CourseTestBase { $this->assertSession()->responseContains('This course is not complete.'); $this->drupalGet("course/{$course->id()}"); $this->assertSession()->linkExistsExact(t('Take course')); $this->assertSession()->linkExistsExact(t('Resume course')); $this->drupalGet("course/{$course->id()}/take"); $this->assertLink('Course object 1'); $this->assertNoLink('Course object 2'); Loading Loading
modules/course_node/tests/src/Functional/CourseNodeTest.php +1 −1 Changes for modules/course_node/tests/src/Functional/CourseNodeTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class CourseNodeTest extends CourseTestBase { $this->drupalLogin($this->student_user); $this->drupalGet('node/1'); $this->clickLink('Course title 1'); $this->clickLink('Take course'); $this->clickLink('Enroll'); $this->clickLink('Complete'); } Loading
src/View/CourseViewBuilder.php +17 −1 Changes for src/View/CourseViewBuilder.php: 17 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,10 +33,26 @@ class CourseViewBuilder extends EntityViewBuilder { } else { // Render take course button. $text = 'Enroll'; // Enrolled. if ($enrollment) { // Completed. if ($enrollment->isComplete()) { $text = 'Review course'; } else { // Not started. $text = 'Take course'; // In progress. if (!empty($enrollment->get('section_name')->getValue())) { $text = 'Resume course'; } } } $build['course'] = [ '#theme' => 'course_take_course_button', '#course' => $course, '#title' => $enrollment && $enrollment->isComplete() ? t('Review course') : t('Take course'), '#title' => $this->t($text), ]; } Loading
tests/src/Functional/CourseWorkflowTest.php +1 −1 Changes for tests/src/Functional/CourseWorkflowTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class CourseWorkflowTest extends CourseTestBase { $this->assertSession()->responseContains('This course is not complete.'); $this->drupalGet("course/{$course->id()}"); $this->assertSession()->linkExistsExact(t('Take course')); $this->assertSession()->linkExistsExact(t('Resume course')); $this->drupalGet("course/{$course->id()}/take"); $this->assertLink('Course object 1'); $this->assertNoLink('Course object 2'); Loading