本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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());
}
示例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]);
}
示例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);
}
示例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);
}
示例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]);
}
示例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]);
}
示例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());
}
示例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]);
}
示例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]);
}
示例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());
}
示例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());
}
示例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());
}