function CourseContextTestCase::testDetermineContext in Course 8.3
Same name and namespace in other branches
- 8.2 tests/src/Functional/CourseContextTestCase.php \Drupal\Tests\course\Functional\CourseContextTestCase::testDetermineContext()
Testing finding course and objects via parameter search.
File
- tests/
src/ Functional/ CourseContextTestCase.php, line 15
Class
- CourseContextTestCase
- Tests for Course context
Namespace
Drupal\Tests\course\FunctionalCode
function testDetermineContext() {
$course = $this
->createCourse();
// Create an object and give it an instance.
$co1 = $this
->createCourseObject($course);
$co1
->setInstanceId(1234)
->save();
// Find course object via cgco.
$find_co1 = course_get_course_object('course_test_object', 1234);
$this
->assertEqual($co1
->getId(), $find_co1
->getId(), 'Found the same course object.');
// Find the course via cdc.
$find_course1 = course_determine_context('course_test_object', 1234);
$this
->assertEqual($find_course1
->id(), $course
->id(), 'Context came back to the same course.');
}