Created
June 27, 2018 06:27
-
-
Save shardiwal/4d55b9442ce3d511db7c64b419d6706f to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Portfolio->context->run(sub { | |
# Create a users for testing purposes | |
my $admin = Portfolio::User->new(); | |
$admin->nickname('t120_available_course_ui_user'); | |
$admin->store(); | |
# Login | |
my $req = Portfolio->context->request; | |
$req->session->set_user( $admin ); | |
# Create institution to enroll into | |
my $inst = Portfolio::Institution->new(); | |
$inst->name( 't120_available_course_ui_institute' ); | |
$inst->store(); | |
# Create course | |
my $course = Portfolio::Course->new(); | |
$course->name( "t120_available_course_ui_course" ); | |
$course->store(); | |
# Add course to institution | |
my $inst_course = Portfolio::InstitutionCourse->new(); | |
$inst_course->institution( $inst ); | |
$inst_course->course( $course ); | |
$inst_course->store(); | |
# Add student | |
$student = Portfolio::User->new(); | |
$student->nickname('t120_available_course_ui_student'); | |
$student->store(); | |
# Add editor | |
my $editor = Portfolio::User->new(); | |
$editor->nickname('t120_available_course_ui_editor'); | |
$editor->store(); | |
# Add supervisor | |
my $supervisor = Portfolio::User->new(); | |
$supervisor->nickname('t120_available_course_ui_supervisor'); | |
$supervisor->store(); | |
$inst->add_member($student->id ,'student'); | |
$inst->add_member($editor->id ,'editor'); | |
$inst->add_member($supervisor->id ,'supervisor'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment