コード例 #1
0
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
 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
0
ファイル: CourseTest.php プロジェクト: Camolot/student
 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
0
 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
0
 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
0
ファイル: CourseTest.php プロジェクト: kylepratuch/registrar2
 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
0
 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
0
 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
0
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');
コード例 #16
0
 function test_getStudents()
 {
     //Arrange
     $name3 = "Psychology 101";
     $course_number = "PSY101";
     $test_course = new Course($name3, $course_number);
     $test_course->save();
     $name = "bob";
     $date_of_enrollment = "2015-09-16";
     $test_student = new Student($name, $date_of_enrollment);
     $test_student->save();
     $name2 = "bill";
     $date_of_enrollment2 = "2015-09-15";
     $test_student2 = new Student($name2, $date_of_enrollment2);
     $test_student2->save();
     //Act
     $test_course->addStudent($test_student->getId());
     $test_course->addStudent($test_student2->getId());
     //Assert
     $result = $test_course->getStudents();
     $this->assertEquals([$test_student, $test_student2], $result);
 }
コード例 #17
0
ファイル: CourseTest.php プロジェクト: jtorrespdx/univ
 function testGetStudents()
 {
     //Arrange
     $course_name = "Intro to Art";
     $course_number = "ART101";
     $id = 1;
     $test_course = new Course($course_name, $course_number, $id);
     $test_course->save();
     $name = "Ben";
     $enroll_date = "0000-00-00";
     $id = 1;
     $test_student = new Student($name, $enroll_date, $id);
     $test_student->save();
     $name2 = "David";
     $enroll_date2 = "0000-00-11";
     $id2 = 2;
     $test_student2 = new Student($name2, $enroll_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);
 }