sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Add course and site metadata for the tasks attribute on sensei home endpoint

Open fjorgemota opened this issue 3 years ago • 1 comments
trafficstars

Fixes #5930

Changes proposed in this Pull Request

  • Add "course" and "site" metadata to the "tasks" object in the endpoint for Sensei Home;
  • Add unit tests to check that;

Testing instructions

On a WP installation containing Sensei LMS on this branch:

  1. Run curl --user "user:application password" http://your-host/wp-json/sensei-internal/v1/home | jq .tasks and make sure the "site" object includes the title of the site you're acessing, and the URL to a custom logo if one is defined (or null, if none is defined);
  2. Add a custom logo to the site and verify if the image is linked there;
  3. Now, import the sample course, and verify if that the "course" attribute is still null;
  4. Now, create another course, and verify if the course title you just created appears on the course object, in the attribute title;
  5. Add a featured image to the course you just created, and verify if the link to the image appears correctly in the course object, in the attribute image;
  6. Finally, move the course to the trash, and verify if the course attribute returns null again;

fjorgemota avatar Oct 13 '22 22:10 fjorgemota

Codecov Report

Merging #5936 (9733db5) into feature/new-onboarding-experience (541edc2) will increase coverage by 0.16%. The diff coverage is 100.00%.

:exclamation: Current head 9733db5 differs from pull request most recent head 6fd79f5. Consider uploading reports for the commit 6fd79f5 to get more accurate results

Impacted file tree graph

@@                           Coverage Diff                           @@
##             feature/new-onboarding-experience    #5936      +/-   ##
=======================================================================
+ Coverage                                43.83%   44.00%   +0.16%     
- Complexity                                9143     9190      +47     
=======================================================================
  Files                                      439      441       +2     
  Lines                                    32521    32702     +181     
  Branches                                   252      252              
=======================================================================
+ Hits                                     14257    14389     +132     
- Misses                                   18078    18127      +49     
  Partials                                   186      186              
Impacted Files Coverage Δ
...in/home/tasks/class-sensei-home-tasks-provider.php 100.00% <100.00%> (ø)
includes/admin/class-sensei-home.php 0.00% <0.00%> (-11.87%) :arrow_down:
includes/admin/class-sensei-admin-notices.php 48.41% <0.00%> (-3.48%) :arrow_down:
...cludes/rest-api/class-sensei-rest-api-internal.php 67.56% <0.00%> (-1.01%) :arrow_down:
includes/class-sensei-autoloader.php 14.58% <0.00%> (-0.32%) :arrow_down:
includes/class-sensei-admin.php 22.26% <0.00%> (-0.09%) :arrow_down:
includes/class-sensei.php 27.49% <0.00%> (-0.07%) :arrow_down:
...des/admin/home/class-sensei-home-news-provider.php 100.00% <0.00%> (ø)
...s/admin/home/class-sensei-home-guides-provider.php 100.00% <0.00%> (ø)
...s/admin/home/class-sensei-home-remote-data-api.php 95.08% <0.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 541edc2...6fd79f5. Read the comment docs.

codecov[bot] avatar Oct 13 '22 23:10 codecov[bot]