本文整理汇总了PHP中Course::getStudents方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::getStudents方法的具体用法?PHP Course::getStudents怎么用?PHP Course::getStudents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::getStudents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]);
}
示例2: 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);
}
示例3: 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);
}
示例4: testGetStudents
function testGetStudents()
{
//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();
$name2 = "Obama";
$date2 = "2015-10-13";
$id2 = 2;
$test_student2 = new Student($name2, $date2, $id2);
$test_student2->save();
//Act
$test_course->addStudent($test_student);
$test_course->addStudent($test_student2);
$result = $test_course->getStudents();
//Assert
$this->assertEquals([$test_student, $test_student2], $result);
}
示例5: 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]);
}
示例6: testAddStudent
function testAddStudent()
{
$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();
$test_course->addStudent($test_student);
$this->assertEquals($test_course->getStudents(), [$test_student]);
}
示例7: 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]);
}
示例8: 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);
}
示例9: testGetStudents
function testGetStudents()
{
//Arrange
$name = "Biology";
$number = 101;
$id = 1;
$test_course = new Course($name, $id);
$test_course->save();
$name = "Elliot Michaels";
$date = "2015-08-03";
$id2 = 2;
$test_student = new Student($name, $date, $id2);
$test_student->save();
$name2 = "Agatha Heterodyne";
$date2 = "1866-04-06";
$id3 = 3;
$test_student2 = new Student($name2, $date2, $id3);
$test_student2->save();
//Act
$test_course->addStudent($test_student);
$test_course->addStudent($test_student2);
//Assert
$this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
}
示例10: 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]);
}
示例11: 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]);
}
示例12: testGetStudents
function testGetStudents()
{
//Arrange
$course_name = "History";
$id = 1;
$course_number = "HIST101";
$test_course = new Course($course_name, $id, $course_number);
$test_course->save();
$student_name2 = "Pablo";
$enrollment_date2 = "2015-08-22";
$id2 = 2;
$test_student2 = new Student($student_name2, $id2, $enrollment_date2);
$test_student2->save();
$student_name = "Paco";
$id3 = 3;
$enrollment_date = "2015-06-22";
$test_student = new Student($student_name, $id3, $enrollment_date);
$test_student->save();
//Act
$test_course->addStudent($test_student);
$test_course->addStudent($test_student2);
//Assert
$this->assertEquals($test_course->getStudents(), [$test_student, $test_student2]);
}
示例13: testGetStudents
function testGetStudents()
{
//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();
$student_name2 = "Walter";
$enrollment_date2 = "1888-12-12";
$id3 = 3;
$test_student2 = new Student($student_name2, $enrollment_date2, $id3);
$test_student2->save();
//Act
$test_course->addStudent($test_student);
$test_course->addStudent($test_student2);
//Assert
$this->assertEquals([$test_student, $test_student2], $test_course->getStudents());
}
示例14: 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());
}
示例15: Course
foreach ($courses as $c) {
echo $c->getDescription() . "\n";
$course = $c;
}
$s->deleteCourses($course);
Hypersistence::commit();
$s->load(true);
$courses = $s->getCourses();
foreach ($courses as $c) {
echo $c->getDescription() . "\n";
}
$c = new Course();
$c->setId(1);
$c->load();
echo $c->getDescription() . "\n";
$students = $c->getStudents();
foreach ($students as $s) {
echo $s->getName() . "\n";
}
//SEARCH
$p = new Person();
$p->setName('Mat');
$search = $p->search();
$search->orderBy('name');
$list = $search->execute();
foreach ($list as $p) {
echo $p->getName() . "\n";
}
//Recursive Search
$c = new City();
$c->setName('San');