本文整理汇总了PHP中Student::getCourses方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::getCourses方法的具体用法?PHP Student::getCourses怎么用?PHP Student::getCourses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::getCourses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Student
function test_getCourses()
{
//Arrange
$name = "bob";
$date_of_enrollment = "2015-09-16";
$test_student = new Student($name, $date_of_enrollment);
$test_student->save();
$name2 = "Psychology 101";
$course_number = "PSY101";
$test_course = new Course($name2, $course_number);
$test_course->save();
$name3 = "Philosophy 101";
$course_number2 = "PHIL101";
$test_course2 = new Course($name3, $course_number2);
$test_course2->save();
//Act
$test_student->addCourse($test_course->getId());
$test_student->addCourse($test_course2->getId());
//Assert
$result = $test_student->getCourses();
$this->assertEquals([$test_course, $test_course2], $result);
}
示例2: 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());
}
示例3: 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);
}
示例4:
?>
" />
</td>
</tr>
<tr>
<th>Parent's<br/>Mobile</th>
<td><input type="text" maxlength="10" name="parents_mobile" class="form-control" placeholder="parent\'s mobile number" value="<?php
echo $t->getParentsMobile();
?>
" /></td>
</tr>
<tr>
<th>Regular <br/> Courses</th>
<td>
<textarea name="courses" class="form-control" placeholder="Regular Courses"><?php
echo $t->getCourses();
?>
</textarea>
</td>
</tr>
<tr>
<th>Load <br/> Courses</th>
<td>
<textarea name="courses_load" class="form-control" placeholder="Load Courses"><?php
echo $t->getCoursesLoad();
?>
</textarea>
</td>
</tr>
<tr>
<th>Total Credit Scored</th>
示例5: explode
</div><!-- /.box-header -->
<div class="box-body table-responsive">
<table id="table1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Course Code</th>
<th>Course Name</th>
<th>Classes Attended</th>
<th>Total Classes</th>
<th>Attendance Percentage*</th>
<th>Last Update</th>
</tr>
</thead>
<tbody>
<?php
$courses = $s->getCourses();
$courses = explode(',', $courses);
foreach ($courses as $course) {
?>
<tr>
<td><?php
echo $course;
?>
</td>
<td>
<?php
$c = new Course();
$c->getInfobyId($course);
echo $c->getCourseName();
unset($c);
$a = new Attendance();
示例6: testGetCourses
function testGetCourses()
{
//Arrange
$id = null;
$name = "Intro to Math";
$number = "MATH100";
$test_course = new Course($id, $name, $number);
$test_course->save();
$id2 = null;
$name2 = "Underwater Basketweaving";
$number2 = "BS133";
$test_course2 = new Course($id2, $name2, $number2);
$test_course2->save();
$id3 = null;
$student_name = "Billy";
$enroll_date = "2015-09-18";
$test_student = new Student($id3, $student_name, $enroll_date);
$test_student->save();
//Act
$test_student->addCourse($test_course);
$test_student->addCourse($test_course2);
//Assert
$this->assertEquals([$test_course, $test_course2], $test_student->getCourses());
}
示例7: 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);
}
示例8: Course
function test_getCourses()
{
//Arrange
$name = "History of Rugs";
$course_number = "200";
$id = 1;
$test_course = new Course($name, $course_number, $id);
$test_course->save();
$name2 = "White Russians";
$course_number2 = "400";
$id2 = 2;
$test_course2 = new Course($name2, $course_number2, $id2);
$test_course2->save();
$student_name = "Donnie";
$enrollment_date = "yesterday";
$id3 = 3;
$test_student = new Student($student_name, $enrollment_date, $id3);
$test_student->save();
//Act
$test_student->addCourse($test_course);
$test_student->addCourse($test_course2);
$result = $test_student->getCourses();
var_dump($result);
//Assert
$this->assertEquals([$test_course, $test_course2], $result);
}
示例9: testAddCourse
function testAddCourse()
{
$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_student->addCourse($test_course);
$this->assertEquals([$test_course], $test_student->getCourses());
}
示例10: 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]);
}
示例11: 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]);
}
示例12: testGetCourse
function testGetCourse()
{
//Arrange
$course_name = "Intro to Art";
$course_number = "ART101";
$id = 1;
$test_course = new Course($course_name, $course_number, $id);
$test_course->save();
$course_name2 = "Intro to Spanish";
$course_number2 = "SPN101";
$id2 = 2;
$test_course2 = new Course($course_name2, $course_number2, $id2);
$test_course2->save();
$name = "Ben";
$enroll_date = "0000-00-00";
$id = 1;
$test_student = new Student($name, $enroll_date, $id);
$test_student->save();
//Act
$test_student->addCourse($test_course);
$test_student->addCourse($test_course2);
//Assert
$this->assertEquals($test_student->getCourses(), [$test_course, $test_course2]);
}
示例13: 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]);
}
示例14: 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]);
}
示例15: testGetCourses
function testGetCourses()
{
//Arrange
$name = "Biology 101";
$number = 101;
$id = 1;
$test_course = new Course($name, $number, $id);
$test_course->save();
$name2 = "Physics";
$number2 = 101;
$id2 = 2;
$test_course2 = new Course($name2, $number2, $id2);
$test_course2->save();
$name = "Elliot Michaels";
$date = "2015-08-03";
$id = 1;
$test_student = new Student($name, $date, $id);
$test_student->save();
//Act
$test_student->addCourse($test_course);
$test_student->addCourse($test_course2);
//Assert
$this->assertEquals($test_student->getCourses(), [$test_course, $test_course2]);
}