Moondiidev / PennState-Class-Scheduler

SWENG 411 group project repository
2 stars 0 forks source link

Update Course Deletion Method and Add Show Course View #14

Closed MattStrauss closed 3 years ago

MattStrauss commented 3 years ago

Purpose

Prior to this PR if a course was deleted and it was a pre-req or concurrent with another course, the system would throw an error when displaying that course as the pre-req or concurrent dependency was missing. Created static methods on the Course class to handle this properly when deleting a course. Secondarily this PR adds a course show view and limits the display of links such as "edit course" and "create course" to only dev users (through the controller).

Passing Tests

While all of the tests below pass, we are not testing the course deletion method. That is b/c I used json contains in this static methods mentioned above and SQLite (our testing DB, for speed) does not support this functionality. Added TODOs to remember to find a solution when I have more time.

macbook@Matthews-MacBook-Air PennState-Class-Scheduler % php artisan test

   PASS  Tests\Feature\CourseTest
  ✓ auth user can visit courses index
  ✓ auth user sees correct courses on courses index
  ✓ guest can not visit courses index
  ✓ dev auth user can visit create course
  ✓ non dev auth user can not visit create course
  ✓ guest can not visit create course
  ✓ dev auth user can visit edit course
  ✓ non dev auth user can not visit edit course
  ✓ guest can not visit edit course
  ✓ dev auth user can create a course
  ✓ dev auth user can create a course with prerequisites
  ✓ dev auth user can create a course with concurrents
  ✓ dev auth user can create a course with prerequisites and concurrents
  ✓ dev auth user can not create a course with a course title already taken
  ✓ dev auth user can not create a course with a course abbreviation already taken
  ✓ dev auth user can not create a course with no description
  ✓ dev auth user can not create a course with invalid number of credits
  ✓ dev auth user can not create a course with invalid semester choice
  ✓ dev auth user can not create a course with invalid concurrents choice
  ✓ dev auth user can not create a course with invalid prerequisites choice
  ✓ regular auth user can not create a course
  ✓ guest can not create a course
  ✓ dev auth user can update a course
  ✓ dev auth user can update a course with prerequisites
  ✓ dev auth user can update a course with concurrents
  ✓ dev auth user can not update a course with a course title already taken
  ✓ dev auth user can not update a course with a course abbreviation already taken
  ✓ dev auth user can not update a course with no description
  ✓ dev auth user can not update a course with invalid number of credits
  ✓ dev auth user can not update a course with invalid semester choice
  ✓ dev auth user can not update a course with invalid concurrents choice
  ✓ dev auth user can not update a course with invalid prerequisites choice
  ✓ regular auth user can not update a course
  ✓ guest can not update a course
  ✓ regular auth user can not delete a course
  ✓ guest can not delete a course

   PASS  Tests\Feature\RegisterTest
  ✓ guest can register for the site
  ✓ guest can not register with out a penn state email address

  Tests:  38 passed
  Time:   2.72s