Skip to content

Commit

Permalink
MDL-41022 cleanup core_test_generator_testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 24, 2013
1 parent f52f2c9 commit 401c82d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/testing/tests/generator_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Data generators tests
*
* @package core
* @category test
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -30,7 +30,7 @@
* Test data generator
*
* @package core
* @category test
* @category phpunit
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down Expand Up @@ -205,20 +205,17 @@ public function test_enrol_user() {
$this->assertTrue($DB->record_exists('user_enrolments', array('enrolid'=>$maninstance3->id, 'userid'=>$user1->id)));
$this->assertFalse($DB->record_exists('role_assignments', array('contextid'=>$context3->id, 'userid'=>$user1->id)));


$result = $this->getDataGenerator()->enrol_user($user2->id, $course1->id, null, 'self');
$this->assertTrue($result);
$this->assertTrue($DB->record_exists('user_enrolments', array('enrolid'=>$instance1->id, 'userid'=>$user2->id)));
$this->assertTrue($DB->record_exists('role_assignments', array('contextid'=>$context1->id, 'userid'=>$user2->id, 'roleid'=>$studentrole->id)));


$selfplugin->add_instance($course2, array('status'=>ENROL_INSTANCE_ENABLED, 'roleid'=>$teacherrole->id));
$result = $this->getDataGenerator()->enrol_user($user2->id, $course2->id, null, 'self');
$this->assertFalse($result);

$DB->delete_records('enrol', array('enrol'=>'self', 'courseid'=>$course3->id));
$result = $this->getDataGenerator()->enrol_user($user2->id, $course3->id, null, 'self');
$this->assertFalse($result);

}
}

0 comments on commit 401c82d

Please sign in to comment.