Exemplo n.º 1
0
 public function testDeletingUnpublishedCourse()
 {
     // Given
     $this->area2->insert(self::$conn);
     $tpa2 = new CourseProgress($this->area2);
     $tpa2->insert(self::$conn);
     $course = new Course();
     $course->setName('Foo');
     $this->setDefaults($course);
     $course->setIsPublished(false);
     $course->insert(self::$conn);
     $this->insertResult($course, $this->area, $this->user, Question::RESULT_CORRECT);
     $this->insertResult($course, $this->area2, $this->user2, Question::RESULT_INVALID);
     $this->fillRecord($this->area, 3, 2, 1);
     $this->fillRecord($this->area2, 3, 2, 1);
     // When
     $course->remove(self::$conn);
     // Then
     $this->assertNotExists(CourseTables::COURSE_TBL, $course->getId());
     $this->expectCourseProgress($this->area, 3, 2, 1);
     $this->expectCourseProgress($this->area2, 3, 2, 1);
 }