mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-72116 dashboard: Remove some of the current blocks
The following blocks have been removed from the Dashboard: - Online users - Upcoming events - Learning plans - Recently accessed courses This change will only apply on new installations.
This commit is contained in:
parent
1d700796ca
commit
4cb297d4fd
@ -73,7 +73,7 @@ Feature: Use core page resolvers for the I am on the page steps
|
||||
Examples:
|
||||
| description | identifier | shouldsee |
|
||||
| Admin page | "Admin notifications" | Check for available updates |
|
||||
| Home page | Homepage | Recently accessed courses |
|
||||
| Home page | Homepage | Course overview |
|
||||
|
||||
Scenario Outline: When I am on a named page logged in as
|
||||
When I am on the <identifier> page logged in as admin
|
||||
@ -82,4 +82,4 @@ Feature: Use core page resolvers for the I am on the page steps
|
||||
Examples:
|
||||
| description | identifier | shouldsee |
|
||||
| Admin page | "Admin notifications" | Check for available updates |
|
||||
| Home page | Homepage | Recently accessed courses |
|
||||
| Home page | Homepage | Course overview |
|
||||
|
@ -37,6 +37,9 @@ Feature: Manage plan workflow
|
||||
| Test-Plan1 | Test-Comp2 |
|
||||
| Test-Plan2 | Test-Comp1 |
|
||||
| Test-Plan2 | Test-Comp2 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| lp | System | 1 | my-index | content |
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "User manage own draft plan role" role:
|
||||
| capability | permission |
|
||||
|
@ -14,6 +14,9 @@ Feature: Enable the upcoming events block in a course
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| calendar_upcoming | System | 1 | my-index | side-post |
|
||||
|
||||
@javascript
|
||||
Scenario: View a site event in the calendar block
|
||||
|
26
blocks/calendar_upcoming/tests/generator/lib.php
Normal file
26
blocks/calendar_upcoming/tests/generator/lib.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Calendar upcoming events block data generator class.
|
||||
*
|
||||
* @package block_calendar_upcoming
|
||||
* @category test
|
||||
* @copyright 2021 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class block_calendar_upcoming_generator extends testing_block_generator {
|
||||
}
|
26
blocks/lp/tests/generator/lib.php
Normal file
26
blocks/lp/tests/generator/lib.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Learning plans block data generator class.
|
||||
*
|
||||
* @package block_lp
|
||||
* @category test
|
||||
* @copyright 2021 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class block_lp_generator extends testing_block_generator {
|
||||
}
|
@ -89,6 +89,7 @@ Feature: The online users block allow you to see who is currently online
|
||||
And the following config values are set as admin:
|
||||
| block_online_users_onlinestatushiding | 0 |
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should see "Student 1" in the "Online users" "block"
|
||||
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
|
||||
|
||||
|
@ -19,6 +19,9 @@ Feature: The online users block allow you to see who is currently online on dash
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| online_users | System | 1 | my-index | side-post |
|
||||
|
||||
Scenario: View the online users block on the dashboard and see myself
|
||||
Given I log in as "teacher1"
|
||||
|
@ -114,6 +114,7 @@ Feature: The online users block allow you to see who is currently online on fron
|
||||
And the following config values are set as admin:
|
||||
| block_online_users_onlinestatushiding | 0 |
|
||||
When I log in as "student1"
|
||||
And I am on site homepage
|
||||
Then I should see "Student 1" in the "Online users" "block"
|
||||
And "Hide" "icon" should not exist in the ".block.block_online_users" "css_element"
|
||||
|
||||
|
@ -25,6 +25,9 @@ Feature: The recently accessed courses block allows users to easily access their
|
||||
| student1 | C3 | student |
|
||||
| student1 | C4 | student |
|
||||
| student1 | C5 | student |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| recentlyaccessedcourses | System | 1 | my-index | content |
|
||||
|
||||
Scenario: User has not accessed any course
|
||||
Given I log in as "student1"
|
||||
|
26
blocks/recentlyaccessedcourses/tests/generator/lib.php
Normal file
26
blocks/recentlyaccessedcourses/tests/generator/lib.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Recently accessed courses block data generator class.
|
||||
*
|
||||
* @package block_recentlyaccessedcourses
|
||||
* @category test
|
||||
* @copyright 2021 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class block_recentlyaccessedcourses_generator extends testing_block_generator {
|
||||
}
|
@ -325,7 +325,7 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
||||
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
|
||||
|
||||
// Force a setting change to check the returned blocks settings.
|
||||
set_config('displaycategories', 0, 'block_recentlyaccessedcourses');
|
||||
set_config('displaycategories', 0, 'block_myoverview');
|
||||
|
||||
// Get the expected default blocks.
|
||||
$alldefaultblocksordered = $DB->get_records_menu('block_instances',
|
||||
@ -337,15 +337,15 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = core_block_external::get_dashboard_blocks($user->id);
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_block_external::get_dashboard_blocks_returns(), $result);
|
||||
// Expect all blogs except learning plans one (no learning plans to show).
|
||||
$this->assertCount(count($alldefaultblocksordered) - 1, $result['blocks']);
|
||||
// Expect all default blocks defined in blocks_add_default_system_blocks().
|
||||
$this->assertCount(count($alldefaultblocksordered), $result['blocks']);
|
||||
$returnedblocks = array();
|
||||
foreach ($result['blocks'] as $block) {
|
||||
// Check all the returned blocks are in the expected blocks array.
|
||||
$this->assertContains($block['name'], $alldefaultblocksordered);
|
||||
$returnedblocks[] = $block['name'];
|
||||
// Check the configuration returned for this default block.
|
||||
if ($block['name'] == 'recentlyaccessedcourses') {
|
||||
if ($block['name'] == 'myoverview') {
|
||||
// Convert config to associative array to avoid DB sorting randomness.
|
||||
$config = array_column($block['configs'], null, 'name');
|
||||
$this->assertArrayHasKey('displaycategories', $config);
|
||||
@ -353,8 +353,7 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals('plugin', $config['displaycategories']['type']);
|
||||
}
|
||||
}
|
||||
// Remove lp block.
|
||||
array_shift($alldefaultblocksordered);
|
||||
|
||||
// Check that we received the blocks in the expected order.
|
||||
$this->assertEquals(array_values($alldefaultblocksordered), $returnedblocks);
|
||||
}
|
||||
@ -387,8 +386,8 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = core_block_external::get_dashboard_blocks($user->id);
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_block_external::get_dashboard_blocks_returns(), $result);
|
||||
// Expect all blogs plus sticky one except learning plans one (no learning plans to show).
|
||||
$this->assertCount(count($alldefaultblocks), $result['blocks']);
|
||||
// Expect all default blocks defined in blocks_add_default_system_blocks() plus sticky one.
|
||||
$this->assertCount(count($alldefaultblocks) + 1, $result['blocks']);
|
||||
$found = false;
|
||||
foreach ($result['blocks'] as $block) {
|
||||
if ($block['name'] == 'myprofile') {
|
||||
@ -432,8 +431,8 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = core_block_external::get_dashboard_blocks($user->id);
|
||||
// We need to execute the return values cleaning process to simulate the web service server.
|
||||
$result = external_api::clean_returnvalue(core_block_external::get_dashboard_blocks_returns(), $result);
|
||||
// Expect all default blogs plys the one we added except learning plans one (no learning plans to show).
|
||||
$this->assertCount(count($alldefaultblocks), $result['blocks']);
|
||||
// Expect all default blocks defined in blocks_add_default_system_blocks() plus the one we added.
|
||||
$this->assertCount(count($alldefaultblocks) + 1, $result['blocks']);
|
||||
$found = false;
|
||||
foreach ($result['blocks'] as $block) {
|
||||
if ($block['name'] == 'myprofile') {
|
||||
|
@ -2607,7 +2607,7 @@ function blocks_add_default_system_blocks() {
|
||||
$subpagepattern = null;
|
||||
}
|
||||
|
||||
$newblocks = array('timeline', 'private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
|
||||
$newcontent = array('lp', 'recentlyaccessedcourses', 'myoverview');
|
||||
$newblocks = array('timeline', 'private_files', 'badges', 'calendar_month');
|
||||
$newcontent = array('myoverview');
|
||||
$page->blocks->add_blocks(array(BLOCK_POS_RIGHT => $newblocks, 'content' => $newcontent), 'my-index', $subpagepattern);
|
||||
}
|
||||
|
@ -24,4 +24,4 @@ Feature: Add blocks to dashboard page
|
||||
Then I should see "Latest announcements" in the "Latest announcements" "block"
|
||||
And I should see "Latest badges" in the "Latest badges" "block"
|
||||
And I should see "Calendar" in the "Calendar" "block"
|
||||
And I should see "Upcoming events" in the "Upcoming events" "block"
|
||||
And I should not see "Upcoming events"
|
||||
|
@ -45,8 +45,8 @@ Feature: Reset all personalised pages to default
|
||||
And I navigate to "Appearance > Default Dashboard page" in site administration
|
||||
And I press "Blocks editing on"
|
||||
And I add the "Latest announcements" block
|
||||
And I open the "Online users" blocks action menu
|
||||
And I follow "Delete Online users"
|
||||
And I open the "Latest badges" blocks action menu
|
||||
And I follow "Delete Latest badges block"
|
||||
And I press "Yes"
|
||||
And I press "Blocks editing off"
|
||||
And I log out
|
||||
@ -54,13 +54,13 @@ Feature: Reset all personalised pages to default
|
||||
And I log in as "student1"
|
||||
And I follow "Dashboard" in the user menu
|
||||
And I should not see "Latest announcements"
|
||||
And I should see "Online users"
|
||||
And I should see "Latest badges"
|
||||
And I log out
|
||||
|
||||
And I log in as "student3"
|
||||
And I follow "Dashboard" in the user menu
|
||||
And I should not see "Latest announcements"
|
||||
And I should see "Online users"
|
||||
And I should see "Latest badges"
|
||||
And I log out
|
||||
|
||||
And I log in as "admin"
|
||||
@ -73,13 +73,13 @@ Feature: Reset all personalised pages to default
|
||||
And I follow "Dashboard" in the user menu
|
||||
Then I should see "Latest announcements"
|
||||
And I should not see "Comments"
|
||||
And I should not see "Online users"
|
||||
And I should not see "Latest badges"
|
||||
And I log out
|
||||
|
||||
And I log in as "student3"
|
||||
And I follow "Dashboard" in the user menu
|
||||
And I should see "Latest announcements"
|
||||
And I should not see "Online users"
|
||||
And I should not see "Latest badges"
|
||||
And I log out
|
||||
|
||||
# Check that this did not affect the customised profiles.
|
||||
|
@ -26,6 +26,6 @@ Feature: Reset dashboard page to default
|
||||
Then I should not see "Latest announcements"
|
||||
And I should see "Latest badges"
|
||||
And I should see "Calendar"
|
||||
And I should see "Upcoming events"
|
||||
And I should not see "Upcoming events"
|
||||
And I should not see "Comments"
|
||||
And I should not see "Reset page to default"
|
||||
|
Loading…
x
Reference in New Issue
Block a user