本文整理汇总了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());
}