Ejemplo n.º 1
0
 public function setUp()
 {
     $this->project = Project::fetch(self::$conn, 1);
     $this->status = AreaStatus::fetchByProject(self::$conn, 1, $this->project);
     $this->territory = Territory::fetchByProject(self::$conn, 1, $this->project);
     $this->area = Area::newArea($this->project, $this->territory, $this->status, 'Area1');
     $this->area->insert(self::$conn);
     $pp = new CourseProgress($this->area);
     $pp->insert(self::$conn);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     $this->project = Project::fetch(self::$conn, 1);
     $this->status = AreaStatus::fetchByProject(self::$conn, 1, $this->project);
     $this->territory = Territory::fetchByProject(self::$conn, 1, $this->project);
     $this->area = Area::newArea($this->project, $this->territory, $this->status, 'Area1');
     $this->area->insert(self::$conn);
     $this->course = new Course();
     $this->course->setProject($this->project);
     $this->course->setName('Foo');
     $this->course->setAuthorName('Foo');
     $this->course->setAuthorEmail('*****@*****.**');
     $this->course->setPresentationLink('http://www.example.com/');
     $this->course->setIsPublished(true);
     $this->course->insert(self::$conn);
     $lang = new Language();
     $lang->setId(1);
     $this->user = User::newUser('login', 'Some user', $lang);
     $this->user->insert(self::$conn);
     $this->anotherUser = User::newUser('login2', 'Another user', $lang);
     $this->anotherUser->insert(self::$conn);
     $pp = new CourseProgress($this->area);
     $pp->insert(self::$conn);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public function onAreaCreated(AreaEvent $event)
 {
     $courseProgress = new CourseProgress($event->getArea());
     $courseProgress->insert($this->conn);
 }