You are here

function CourseTestBase::createCourse in Course 3.x

Create a course node using the test content type.

Return value

\Drupal\course\Entity\Course

39 calls to CourseTestBase::createCourse()
CourseAccessTest::testDurationExpiration in tests/src/Functional/CourseAccessTest.php
Test the enrollment duration. This does not test the enrollment end date being set correctly.
CourseAccessTest::testReleaseExpiration in tests/src/Functional/CourseAccessTest.php
Test the open/close date functionality.
CourseContextTest::testDetermineContext in tests/src/Functional/CourseContextTest.php
Testing finding course and objects via parameter search.
CourseContextTest::testMultiContext in tests/src/Functional/CourseContextTest.php
Test objects that belong to multiple courses.
CourseDeleteTest::testCourseDelete in tests/src/Functional/CourseDeleteTest.php
Ensure that data is cleaned up after a course is deleted.

... See full list

File

tests/src/Functional/CourseTestBase.php, line 45

Class

CourseTestBase
Master class for Course tests.

Namespace

Drupal\Tests\course\Functional

Code

function createCourse(array $extra = array()) {
  $defaults = array(
    'type' => 'course',
  );
  $course = Course::create(array_merge_recursive($defaults, $extra));
  $course
    ->save();
  return $course;
}