function CourseObjectTestCase::testCourseObjectBasicCrud in Course 7.2
Same name and namespace in other branches
- 6 tests/CourseObjectTestCase.test \CourseObjectTestCase::testCourseObjectBasicCrud()
- 7 tests/CourseObjectTestCase.test \CourseObjectTestCase::testCourseObjectBasicCrud()
Test basic save/load of CourseObjects.
File
- tests/
CourseObjectTestCase.test, line 20
Class
- CourseObjectTestCase
- Description of CourseObjectTestCase
Code
function testCourseObjectBasicCrud() {
$courseNode = $this
->createCourseNode();
// Create the course object
$courseObject = $this
->createCourseObject($courseNode);
// Make sure the object saved.
$this
->assertTrue($courseObject
->getId() > 0, 'Course object received ID.');
$id = $courseObject
->getId();
// Load by coid
$courseObject = course_get_course_object_by_id($id);
$this
->assertTrue($courseObject
->getId() == $id, 'Loaded course object by ID.');
// Delete
course_outline_delete_object($courseObject
->getOptions());
$courseObject = course_get_course_object_by_id($id);
$this
->assertFalse($courseObject, 'Check that deleted object no longer exists.');
}