當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Course::addStudent方法代碼示例

本文整理匯總了PHP中Course::addStudent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::addStudent方法的具體用法?PHP Course::addStudent怎麽用?PHP Course::addStudent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Course的用法示例。


在下文中一共展示了Course::addStudent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Student

 function test_getStudents()
 {
     //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
     $test_course->addStudent($test_student);
     $result = $test_course->getStudents();
     //Assert
     $this->assertEquals([$test_student], $result);
 }
開發者ID:jlbethel,項目名稱:Registrar_test,代碼行數:19,代碼來源:CourseTest.php

示例2: testAddStudent

 function testAddStudent()
 {
     $name = "Jimmy";
     $enrollment_date = "2015";
     $test_student = new Student($name, $enrollment_date);
     $test_student->save();
     $course_name = "Real Analysis I";
     $course_number = "Math 540";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     $test_course->addStudent($test_student);
     $this->assertEquals([$test_student], $test_course->getStudent());
 }
開發者ID:juliocesardiaz,項目名稱:UniRegis,代碼行數:13,代碼來源:CourseTest.php

示例3: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Math";
     $date = '0000-00-00';
     $id = 1;
     $test_course = new Course($name, $id);
     $test_course->save();
     $student_name = "File reports";
     $id2 = 2;
     $course_id = $test_course->getId();
     $test_student = new Student($student_name, $id2, $date, $course_id);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->delete();
     //Assert
     $this->assertEquals([], $test_student->getCourses());
 }
開發者ID:JordanNavratil,項目名稱:University_Registrar2,代碼行數:19,代碼來源:CourseTest.php

示例4: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Math";
     $course_num = "101";
     $id = 1;
     $test_course = new Course($name, $course_num, $id);
     $test_course->save();
     $name = "Rick";
     $date = "2015-08-15";
     $id = 1;
     $test_student = new Student($name, $date, $id);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->delete();
     //Assert
     $this->assertEquals([], $test_student->getCourses());
 }
開發者ID:jlbethel,項目名稱:Registrar-switch,代碼行數:19,代碼來源:CourseTest.php

示例5: testGetStudents

 function testGetStudents()
 {
     $name = "Mike";
     $enrollment_date = "2015-12-12";
     $test_student = new Student($name, $enrollment_date);
     $test_student->save();
     $name2 = "The Same Exact Name";
     $enrollment_date2 = "2015-12-12";
     $test_student2 = new Student($name2, $enrollment_date2);
     $test_student2->save();
     $course_name = "Real Analysis I";
     $course_number = "Math 540";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     $test_course->addStudent($test_student);
     $test_course->addStudent($test_student2);
     $this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
 }
開發者ID:nathanhwyoung,項目名稱:switched_registrar,代碼行數:18,代碼來源:CourseTest.php

示例6: testAddStudent

 function testAddStudent()
 {
     //Arrange
     $name = "History";
     $course_number = "HIST101";
     $id = 1;
     $test_course = new Course($name, $course_number, $id);
     $test_course->save();
     $student_name = "Lebowski";
     $enrollment_date = "2015-03-03";
     $id2 = 2;
     $test_student = new Student($student_name, $enrollment_date, $id2);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $result = $test_course->getStudents();
     //Assert
     $this->assertEquals([$test_student], $result);
 }
開發者ID:kevintokheim,項目名稱:University_Registrar2,代碼行數:19,代碼來源:CourseTest.php

示例7: Student

 function test_deleteAllStudents()
 {
     //Arrange
     $name = "Wesley Pong";
     $enrollment_date = "2015-09-09";
     $id = 1;
     $test_student = new Student($name, $enrollment_date, $id);
     $test_student->save();
     $name2 = "Billy Bodega";
     $enrollment_date2 = "2015-09-09";
     $id2 = 1;
     $test_student2 = new Student($name2, $enrollment_date2, $id2);
     $test_student2->save();
     $course_name = "History";
     $id2 = 2;
     $course_number = 'HIST:101';
     $test_course = new Course($course_name, $course_number, $id2);
     $test_course->save();
     $test_course->addStudent($test_student->getId());
     $test_course->addStudent($test_student2->getId());
     //Act
     $test_course->deleteAllStudents($test_student->getId());
     $result = $test_course->getStudents();
     //Assert
     $this->assertEquals([], $result);
 }
開發者ID:jeffaustin81,項目名稱:University_Registrar,代碼行數:26,代碼來源:CourseTest.php

示例8: Course

 function test_addStudent_and_getStudents()
 {
     $name = "Western Civ";
     $number = "HST 101";
     $test_course = new Course($name, $number);
     $test_course->save();
     $name = "Chris";
     $date = "1111-11-11";
     $test_student = new Student($name, $date);
     $test_student->save();
     $name2 = "Dillon";
     $test_student2 = new Student($name2, $date);
     $test_student2->save();
     $test_course->addStudent($test_student);
     $test_course->addStudent($test_student2);
     $this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
 }
開發者ID:austinblanchard,項目名稱:university_registrar_switch,代碼行數:17,代碼來源:CourseTest.php

示例9: Course

 function test_getStudents()
 {
     //Arrange
     $test_course = new Course("Fundamentals of Human Anatomy", "SEXY101");
     $test_course->save();
     $test_course2 = new Course("Organic Chemistry of Cannabinoids", "CHEM420");
     $test_course2->save();
     $test_student = new Student("Sarah", "2000-04-01");
     $test_student->save();
     $test_student2 = new Student("JC", "0000-12-25");
     $test_student2->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->addStudent($test_student2);
     $test_course2->addStudent($test_student);
     //Assert
     $this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
 }
開發者ID:umamiMike,項目名稱:registar_epic,代碼行數:18,代碼來源:CourseTest.php

示例10: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Biology";
     $number = 101;
     $id = 1;
     $test_course = new Course($name, $number, $id);
     $test_course->save();
     $name = "Elliot Michaels";
     $date = "2015-08-03";
     $id2 = 2;
     $test_student = new Student($name, $date, $id2);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->delete();
     //Assert
     $this->assertEquals([], $test_student->getCourses());
 }
開發者ID:Camolot,項目名稱:student,代碼行數:19,代碼來源:CourseTest.php

示例11: testGetStudents

 function testGetStudents()
 {
     //Arrange
     $id = null;
     $name = "Intro to Math";
     $number = "MATH100";
     $test_course = new Course($id, $name, $number);
     $test_course->save();
     $name2 = "Micah";
     $id2 = null;
     $enrollment_date = "2015-09-13";
     $test_student = new Student($id, $name2, $enrollment_date);
     $test_student->save();
     $name3 = "Phil";
     $id3 = null;
     $enrollment_date2 = "2015-09-03";
     $test_student2 = new Student($id3, $name3, $enrollment_date2);
     $test_student2->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->addStudent($test_student2);
     //Assert
     $this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
 }
開發者ID:kellimargaret,項目名稱:University_Registrar_Part2,代碼行數:24,代碼來源:CourseTest.php

示例12: testGetCategories

 function testGetCategories()
 {
     //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();
     $student_name2 = "Billy Joe Jim Bob";
     $student_id2 = 2;
     $test_student2 = new Student($student_name2, $date_enrolled, $student_id2);
     $test_student2->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_course->addStudent($test_student);
     $test_course->addStudent($test_student2);
     //Assert
     $this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
 }
開發者ID:nathanhwyoung,項目名稱:registrar,代碼行數:23,代碼來源:CourseTest.php

示例13: testDelete

 function testDelete()
 {
     //Arrange
     $course_name = "History";
     $id = 1;
     $course_number = "HIST101";
     $test_course = new Course($course_name, $id, $course_number);
     $test_course->save();
     $student_name = "Paco";
     $id2 = 2;
     $enrollment_date = "2015-05-11";
     $test_student = new Student($student_name, $id2, $enrollment_date);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->deleteOne();
     //Assert
     $this->assertEquals([], $test_student->getCourses());
 }
開發者ID:kylepratuch,項目名稱:registrar2,代碼行數:19,代碼來源:CourseTest.php

示例14: testDelete

 function testDelete()
 {
     //Arrange
     $name = "Bowling";
     $course_number = "400";
     $id = 1;
     $test_course = new Course($name, $course_number, $id);
     $test_course->save();
     $student_name = "Jeff Lebowski";
     $enrollment_date = "1989-12-12";
     $id2 = 2;
     $test_student = new Student($student_name, $enrollment_date, $id2);
     $test_student->save();
     //Act
     $test_course->addStudent($test_student);
     $test_course->delete();
     //Assert
     $this->assertEquals([], $test_student->getCourses());
 }
開發者ID:alexdbrown,項目名稱:university_registrar,代碼行數:19,代碼來源:CourseTest.php

示例15: testDelete

 function testDelete()
 {
     $name = "History";
     $course_number = "HIST100";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $name = "Bob";
     $enrollment_date = "2015-01-01";
     $test_student = new Student($name, $enrollment_date);
     $test_student->save();
     $test_course->addStudent($test_student);
     $test_course->delete();
     $this->assertEquals([], $test_course->getStudents());
 }
開發者ID:julianstewart,項目名稱:university_registrar2,代碼行數:14,代碼來源:CourseTest.php


注:本文中的Course::addStudent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。