当前位置: 首页>>代码示例>>PHP>>正文


PHP Student::addCourse方法代码示例

本文整理汇总了PHP中Student::addCourse方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::addCourse方法的具体用法?PHP Student::addCourse怎么用?PHP Student::addCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Student的用法示例。


在下文中一共展示了Student::addCourse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetCourses

 function testGetCourses()
 {
     //Arrange
     $date_enrolled = "2015-10-10";
     $student_name = "Ben Baker Billington";
     $student_id = 1;
     $test_student = new Student($student_name, $date_enrolled, $student_id);
     $test_student->save();
     $course_name2 = "Billy Joe Jim Bob";
     $course_id2 = 2;
     $test_course2 = new Course($course_name2, $date_enrolled, $course_id2);
     $test_course2->save();
     $course_name = "Jammin it, dude";
     $course_number = "102";
     $course_id = 3;
     $test_course = new Course($course_name, $course_number, $course_id);
     $test_course->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     //Assert
     $this->assertEquals([$test_course, $test_course2], $test_student->getCourses());
 }
开发者ID:juliocesardiaz,项目名称:UniRegisSwitch,代码行数:23,代码来源:StudentTest.php

示例2: Student

 function test_addCourse()
 {
     //Arrange
     $name = "Steve Beekman";
     $date = "2015-08-23";
     $test_student = new Student($name, $date);
     $test_student->save();
     $title = "Intro to Typing: COM-91";
     $teacher = "Ancient Raven";
     $time = "TH 9PM-11PM";
     $semester = "Fall";
     $test_course = new Course($title, $teacher, $time, $semester);
     $test_course->save();
     //Act
     $result = [$test_course];
     $test_student->addCourse($test_course);
     //Assert
     $this->assertEquals($test_student->getCourses(), $result);
 }
开发者ID:jlbethel,项目名称:Registrar_test,代码行数:19,代码来源:StudentTest.php

示例3: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Biology 101";
     $number = 101;
     $id = 1;
     $test_course = new Course($name, $number, $id);
     $test_course->save();
     $name = "Auto";
     $number2 = 101;
     $id2 = 2;
     $test_student = new Student($name, $date, $id2);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->delete();
     //Assert
     $this->assertEquals([], $test_course->getStudents());
 }
开发者ID:Camolot,项目名称:student,代码行数:19,代码来源:StudentTest.php

示例4: Course

 function test_addCourse()
 {
     //Arrange
     $course_name = "MTH101";
     $crn = 1234;
     $id = 1;
     $test_course = new Course($course_name, $crn, $id);
     $test_course->save();
     $student_name = "Bob";
     $enroll_date = "2012-10-20";
     $id2 = 2;
     $test_student = new Student($student_name, $enroll_date, $id2);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     //Assert
     $this->assertEquals($test_student->getCourses(), [$test_course]);
 }
开发者ID:kylepratuch,项目名称:registrar,代码行数:18,代码来源:StudentTest.php

示例5: Course

 function test_addCourse()
 {
     //Arrange
     $name = "bowling";
     $id = 1;
     $course_number = "400";
     $test_course = new Course($name, $course_number, $id);
     $test_course->save();
     $name2 = "Lebowski";
     $enrollment_date = "2015-12-12";
     $id2 = 2;
     $test_student = new Student($name2, $enrollment_date, $id2);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     $result = $test_student->getCourses();
     //Assert
     $this->assertEquals([$test_course], $result);
 }
开发者ID:kevintokheim,项目名称:University_Registrar2,代码行数:19,代码来源:StudentTest.php

示例6: testDelete

 function testDelete()
 {
     //Arrange
     $course_name = "History";
     $id = 1;
     $crn = "HIST101";
     $test_course = new Course($course_name, $crn, $id);
     $test_course->save();
     $student_name = "Paco";
     $id2 = 2;
     $enroll_date = "2015-05-11";
     $test_student = new Student($student_name, $enroll_date, $id2);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->deleteOne();
     //Assert
     $this->assertEquals([], $test_course->getStudents());
 }
开发者ID:kennygrage,项目名称:epicUniversityFromPartners,代码行数:19,代码来源:StudentTest.php

示例7: Course

 function test_addCourse_and_getCourses()
 {
     $name = "Western Civ";
     $number = "HST 101";
     $test_course = new Course($name, $number);
     $test_course->save();
     $name2 = "Remedial Math";
     $number2 = "MTH 64";
     $test_course2 = new Course($name2, $number2);
     $test_course2->save();
     $name = "Chris";
     $date = "1111-11-11";
     $test_student = new Student($name, $date);
     $test_student->save();
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     $this->assertEquals($test_student->getCourses(), [$test_course, $test_course2]);
 }
开发者ID:austinblanchard,项目名称:university_registrar_switch,代码行数:18,代码来源:StudentTest.php

示例8: getAddress

     */
    public function getAddress()
    {
        return $this->address;
    }
    /**
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}
$student = new Student(123, 'Bill', '123 foo road');
$student->addCourse('PHP')->addCourse('Python')->addCourse('Ruby');
echo '<pre>';
print_r($student);
echo 'Parent Class: ' . get_parent_class($student);
if ($student instanceof Person) {
    echo 'Yeah';
} else {
    echo 'No';
}
echo "\n\n";
开发者ID:sameg14,项目名称:PHPMastery,代码行数:31,代码来源:inheritance.php

示例9: Course

 function test_getCourses()
 {
     //Arrange
     $course_name = "Being a bum";
     $id = 1;
     $test_course = new Course($course_name, $id);
     $test_course->save();
     $course_name2 = "Getting a toe";
     $id2 = 2;
     $test_course2 = new Course($course_name2, $id2);
     $test_course2->save();
     $student_name = "Jeff Lebowski";
     $id3 = 3;
     $test_student = new Student($student_name, $id3);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     //Assert
     $this->assertEquals($test_student->getCourses(), [$test_course, $test_course2]);
 }
开发者ID:kevintokheim,项目名称:University_Registrar,代码行数:21,代码来源:StudentTest.php

示例10: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Ben";
     $enroll_date = "0000-00-00";
     $id = 1;
     $test_student = new Student($name, $enroll_date, $id);
     $test_student->save();
     $course_name = "Intro to Art";
     $course_number = "ART101";
     $id = 1;
     $test_course = new Course($course_name, $course_number, $id);
     $test_course->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->delete();
     //Assert
     $this->assertEquals([], $test_course->getStudents());
 }
开发者ID:jtorrespdx,项目名称:univ,代码行数:19,代码来源:StudentTest.php

示例11: Department

 function test_updateCompleted()
 {
     //Arrange
     $test_department = new Department("Biology", "346 Stupid Avenue");
     $test_department->save();
     $test_student = new Student("Shmuel Irving-Jones", "2015-08-25", $test_department->getId());
     $test_student->save();
     $test_course = new Course("High Times", "CHEM420", $test_department->getId());
     $test_course->save();
     $test_course2 = new Course("Gavanese Jamelan", "MUSC69", $test_department->getId());
     $test_course2->save();
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     //Act
     $test_student->updateCompleted($test_course->getId());
     //Assert
     $this->assertEquals(true, $test_student->getCompleted($test_course->getId()));
 }
开发者ID:ashlinaronin,项目名称:back2school_fam,代码行数:18,代码来源:StudentTest.php

示例12: testGetCourses

 function testGetCourses()
 {
     $student_name = "John Doe";
     $enrollment_date = "2015-09-01";
     $test_student = new Student($student_name, $enrollment_date);
     $test_student->save();
     $course_name = "History";
     $course_code = "HIST100";
     $test_course = new Course($course_name, $course_code);
     $test_course->save();
     $course_name2 = "Gym";
     $course_code2 = "GYM100";
     $test_course2 = new Course($course_name2, $course_code2);
     $test_course2->save();
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     $this->assertEquals($test_student->getCourses(), [$test_course2, $test_course]);
 }
开发者ID:julianstewart,项目名称:university_registrar,代码行数:18,代码来源:StudentTest.php

示例13: testGetCourses

 function testGetCourses()
 {
     //Arrange
     $name = "Math";
     $course_num = "101";
     $id = 1;
     $test_course = new Course($name, $course_num, $id);
     $test_course->save();
     $name2 = "English";
     $course_num2 = "200";
     $id2 = 2;
     $test_course2 = new Course($name2, $course_num2, $id2);
     $test_course2->save();
     $name = "Rick";
     $date = "2015-08-15";
     $id = 1;
     $test_student = new Student($name, $date, $id);
     $test_student->save();
     //Act
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     $result = $test_student->getCourses();
     //Assert
     $this->assertEquals([$test_course, $test_course2], $result);
 }
开发者ID:jlbethel,项目名称:Registrar-switch,代码行数:25,代码来源:StudentTest.php

示例14: loadAllStudents

 function loadAllStudents()
 {
     $start = microtime(true);
     $statement = "SELECT * FROM Action";
     $result = mysqli_query($GLOBALS['CONFIG']['mysqli'], $statement);
     /*if(mysqli_fetch_array($result)==null){
           return 1;
       }
       $query = new Query('action');
       $queryActions = $query->select('*',true);*/
     //Need to return ordered by session_id
     //This takes quite a bit of time. Need to shorten it.
     $end = microtime(true);
     echo 'MYSQL * action query took ' . ($end - $start) . ' seconds!<br>';
     $start = microtime(true);
     //$newStudent = new Student();
     //In order, add each student to the list, adding each course that they took, no, or yes.
     //foreach($queryActions as $action){
     while ($row = mysqli_fetch_row($result)) {
         /*
                     $id = $action->get('session_id');
                     $course = $action->get('course_id');
                     $major = $action->get('major');
                     $year = $action->get('year');
                     $choice = $action->get('choice');*/
         $id = $row[6];
         $course = $row[3];
         $major = $row[1];
         $year = $row[2];
         $choice = $row[4];
         if (isset($this->StudentList[$id])) {
             $CurrentStudent = $this->StudentList[$id];
             $CurrentStudent->addCourse($course, $choice);
         } else {
             $CurrentStudent = new Student($id);
             $CurrentStudent->setMajor($major);
             $CurrentStudent->setYear($year);
             $CurrentStudent->addCourse($course, $choice);
         }
         $this->StudentList[$id] = $CurrentStudent;
     }
     $end = microtime(true);
     echo 'PHP database class creation took ' . ($end - $start) . ' seconds!<br>';
 }
开发者ID:bennyty,项目名称:suggestr,代码行数:44,代码来源:suggestions.php

示例15: testGetCourses

 function testGetCourses()
 {
     $name = "Bob";
     $enrollment_date = "2015-01-01";
     $test_student = new Student($name, $enrollment_date);
     $test_student->save();
     $course_name = "History";
     $course_number = "HIST100";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     $course_name2 = "Math";
     $course_number2 = "MATH100";
     $test_course2 = new Course($course_name, $course_number);
     $test_course2->save();
     $test_student->addCourse($test_course);
     $test_student->addCourse($test_course2);
     $this->assertEquals($test_student->getCourses(), [$test_course, $test_course2]);
 }
开发者ID:julianstewart,项目名称:university_registrar2,代码行数:18,代码来源:StudentTest.php


注:本文中的Student::addCourse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。