function CourseContextTest::testDetermineContext in Course 3.x
Testing finding course and objects via parameter search.
File
- tests/
src/ Functional/ CourseContextTest.php, line 15
Class
- CourseContextTest
- 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
->id(), $find_co1
->id(), '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.');
}