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


PHP Course::getAll方法代碼示例

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


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

示例1: find

 static function find($search_id)
 {
     $found_course = null;
     $courses = Course::getAll();
     foreach ($courses as $course) {
         $course_id = $course->getCourseId();
         if ($course_id == $search_id) {
             $found_course = $course;
         }
     }
     return $found_course;
 }
開發者ID:juliocesardiaz,項目名稱:UniRegisSwitch,代碼行數:12,代碼來源:Course.php

示例2: test_deleteOne

 function test_deleteOne()
 {
     $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();
     $test_course->deleteOne();
     $this->assertEquals(Course::getAll(), [$test_course2]);
 }
開發者ID:austinblanchard,項目名稱:university_registrar_switch,代碼行數:13,代碼來源:CourseTest.php

示例3: testGetAll

 function testGetAll()
 {
     $name = "History";
     $course_number = "HIST100";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $name2 = "Math";
     $course_number2 = "MATH100";
     $test_course2 = new Course($name, $course_number);
     $test_course2->save();
     $result = Course::getAll();
     $this->assertEquals([$test_course, $test_course2], $result);
 }
開發者ID:julianstewart,項目名稱:university_registrar2,代碼行數:13,代碼來源:CourseTest.php

示例4: testSave

 function testSave()
 {
     //Arrange
     $course_name = "HISTORY";
     $number = 101;
     $test_course = new Course($course_name, $number);
     //var_dump($test_course);
     //Act
     $test_course->save();
     //Assert
     $result = Course::getAll();
     $this->assertEquals($test_course, $result[0]);
 }
開發者ID:bencasalino,項目名稱:registrar-afternoon,代碼行數:13,代碼來源:courseTest.php

示例5: test_getAll

 function test_getAll()
 {
     //Arrange
     $name = "Math";
     $course_number = "112";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $name2 = "History";
     $course_number2 = "112";
     $test_course2 = new Course($name2, $course_number2);
     $test_course2->save();
     $result = Course::getAll();
     $this->assertEquals([$test_course, $test_course2], $result);
 }
開發者ID:juliocesardiaz,項目名稱:UniRegis,代碼行數:14,代碼來源:CourseTest.php

示例6: testDelete

 function testDelete()
 {
     //Arrange
     $course_name = "Vampires";
     $course_number = 1;
     $id = 1;
     $test_course = new Course($course_name, $course_number, $id);
     $test_course->save();
     $course_name2 = "Discrete Math";
     $course_number2 = 1;
     $id2 = 2;
     $test_course2 = new Course($course_name2, $course_number2, $id2);
     $test_course2->save();
     //Act
     $test_course->delete();
     //Assert
     $this->assertEquals([$test_course2], Course::getAll());
 }
開發者ID:kevintokheim,項目名稱:University_Registrar,代碼行數:18,代碼來源:CourseTest.php

示例7: testUpdateCourse

 function testUpdateCourse()
 {
     $name = "John Doe";
     $password = "password";
     $email = "johndoe@osa.biz";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $title = "Literature";
     $subject = "English";
     $description = "Deconstructing English literature.";
     $user_id = $test_user->getId();
     $test_course = new Course($title, $subject, $description, $user_id);
     $test_course->save();
     $title2 = "Algebra";
     $subject2 = "Math";
     $description2 = "Introduction to algebraic equations.";
     $test_course->updateCourse($title2, $subject2, $description2);
     $result = Course::getAll();
     $this->assertEquals($test_course, $result[0]);
 }
開發者ID:kylepratuch,項目名稱:EdBuilder,代碼行數:21,代碼來源:CourseTest.php

示例8: testDeleteCourse

 function testDeleteCourse()
 {
     $name = "Math";
     $id = 1;
     $test_course = new Course($name);
     $test_course->save();
     $name2 = "Science";
     $id2 = 2;
     $test_course2 = new Course($name2);
     $test_course2->save();
     $test_course->delete();
     $this->assertEquals([$test_course2], Course::getAll());
 }
開發者ID:JordanNavratil,項目名稱:University_Registrar2,代碼行數:13,代碼來源:CourseTest.php

示例9: test_deleteOne

 function test_deleteOne()
 {
     $course_name = "History";
     $course_number = "HIST 101";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     $course_name2 = "Biology";
     $course_number2 = "BIO 101";
     $test_course2 = new Course($course_name2, $course_number2);
     $test_course2->save();
     $test_course->deleteOne();
     $this->assertEquals([$test_course2], Course::getAll());
 }
開發者ID:CharlesAMoss,項目名稱:epic_Registrar_part2,代碼行數:13,代碼來源:CourseTest.php

示例10: test_save

 function test_save()
 {
     //Arrange
     $course_name = "Monster Literature";
     $course_number = "ENG304";
     $test_course = new Course($course_name, $course_number);
     $test_course->save();
     //Act
     $result = Course::getAll();
     //Assert
     $this->assertEquals($test_course, $result[0]);
 }
開發者ID:kellimargaret,項目名稱:University_Registrar,代碼行數:12,代碼來源:CourseTest.php

示例11: testDeleteAll

 function testDeleteAll()
 {
     //Arrange
     $name = "Biology";
     $number = 101;
     $id = 1;
     $name2 = "Auto";
     $number2 = 101;
     $id2 = 2;
     $test_course = new Course($name, $number, $id);
     $test_course->save();
     $test_course2 = new Course($name2, $number2, $id2);
     $test_course2->save();
     //Act
     Course::deleteAll();
     //Assert
     $result = Course::getAll();
     $this->assertEquals([], $result);
 }
開發者ID:Camolot,項目名稱:student,代碼行數:19,代碼來源:CourseTest.php

示例12: testDeleteAll

 function testDeleteAll()
 {
     //Arrange
     $name = "Psychology 101";
     $course_number = "2015-08-15";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $name2 = "Psychology 102";
     $course_number2 = "PSY102";
     $test_course2 = new Course($name2, $course_number2);
     $test_course2->save();
     //Act
     Course::deleteAll();
     //Assert
     $result = Course::getAll();
     $this->assertEquals([], $result);
 }
開發者ID:jeffaustin81,項目名稱:University_Registrar_Continued,代碼行數:17,代碼來源:CourseTest.php

示例13: testDeleteAll

 function testDeleteAll()
 {
     //Arrange
     $name = "History";
     $course_number = "HIST101";
     $name2 = "English";
     $course_number2 = "ENG500";
     $test_course = new Course($name, $course_number);
     $test_course->save();
     $test_course2 = new Course($name2, $course_number2);
     $test_course2->save();
     //Act
     Course::deleteAll();
     //Assert
     $result = Course::getAll();
     $this->assertEquals([], $result);
 }
開發者ID:austinblanchard,項目名稱:university_registrar,代碼行數:17,代碼來源:CourseTest.php

示例14: function

});
$app->get("/students/{id}", function ($id) use($app) {
    $student = Student::find($id);
    return $app['twig']->render('student.html.twig', array('student' => $student, 'courses' => $student->getCourses(), 'all_courses' => Course::getAll()));
});
$app->get("/students/{id}/edit", function ($id) use($app) {
    $student = Student::find($id);
    return $app['twig']->render('student_edit.html.twig', array('student' => $student));
});
$app->patch("/students/{id}", function ($id) use($app) {
    $name = $_POST['name'];
    $student = Student::find($id);
    $student->update($name);
    return $app['twig']->render('student.html.twig', array('student' => $student, 'courses' => $student->getCourses(), 'all_courses' => Course::getAll()));
});
$app->post("/add_students", function () use($app) {
    $course = Course::find($_POST['course_id']);
    $student = Student::find($_POST['student_id']);
    $course->addStudent($student);
    return $app['twig']->render('course.html.twig', array('course' => $course, 'courses' => Course::getAll(), 'students' => $course->getStudents(), 'all_students' => Student::getAll()));
});
$app->post("/delete_students", function () use($app) {
    Student::deleteAll();
    return $app['twig']->render('index.html.twig');
});
$app->delete("/students/{id}", function ($id) use($app) {
    $student = Student::find($id);
    $student->delete();
    return $app['twig']->render('students.html.twig', array('students' => Student::getAll()));
});
return $app;
開發者ID:jtorrespdx,項目名稱:univ2,代碼行數:31,代碼來源:app.php

示例15: test_delete

 function test_delete()
 {
     //Arrange
     $name = "High Times";
     $code = "CHEM420";
     $test_course = new Course($name, $code);
     $test_course->save();
     $name2 = "Gavanese Jamelan";
     $code2 = "MUSC69";
     $test_course2 = new Course($name2, $code2);
     $test_course2->save();
     //Act
     $test_course->delete();
     $result = Course::getAll();
     //Assert
     $this->assertEquals($test_course2, $result[0]);
 }
開發者ID:umamiMike,項目名稱:registar_epic,代碼行數:17,代碼來源:CourseTest.php


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