本文整理匯總了PHP中Course::deleteOne方法的典型用法代碼示例。如果您正苦於以下問題:PHP Course::deleteOne方法的具體用法?PHP Course::deleteOne怎麽用?PHP Course::deleteOne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Course
的用法示例。
在下文中一共展示了Course::deleteOne方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Course
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]);
}
示例2: Course
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());
}
示例3: testDeleteCourse
function testDeleteCourse()
{
//Arrange
$course_name = "Economics";
$id = 1;
$crn = "ECON101";
$test_course = new Course($course_name, $crn, $id);
$test_course->save();
$course_name2 = "History";
$id2 = 2;
$crn2 = "HIST101";
$test_course2 = new Course($course_name, $crn2, $id2);
$test_course2->save();
//Act
$test_course->deleteOne();
//Assert
$this->assertEquals([$test_course2], Course::getAll());
}
示例4: 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());
}