public function CourseObjectUbercartTestCase::testBypassFreeCourses in Course 7
Same name and namespace in other branches
- 8.3 modules/course_uc/course_uc.test \CourseObjectUbercartTestCase::testBypassFreeCourses()
- 8.2 modules/course_uc/course_uc.test \CourseObjectUbercartTestCase::testBypassFreeCourses()
- 7.2 modules/course_uc/course_uc.test \CourseObjectUbercartTestCase::testBypassFreeCourses()
File
- modules/
course_uc/ course_uc.test, line 103
Class
- CourseObjectUbercartTestCase
- Test class for dealing with adding and removing elements from the course outline.
Code
public function testBypassFreeCourses() {
$this
->setCourseTestToProduct();
// Create a product node.
$courseNode = $this
->createCourseNode(array(
'sell_price' => 0,
'unique_hash' => uniqid(),
));
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
// Default behavior is that add to cart does not show up on a $0 course.
$this
->drupalGet("node/{$courseNode->nid}");
$this
->assertNoRaw(t('Add to cart'));
// Turn bypass off and check that the add to cart button shows.
variable_set('course_access_bypass_checkout', 0);
$this
->drupalGet("node/{$courseNode->nid}");
$this
->assertRaw(t('Add to cart'));
}