Línea 35... |
Línea 35... |
35 |
*/
|
35 |
*/
|
36 |
class provider_test extends \core_privacy\tests\provider_testcase {
|
36 |
class provider_test extends \core_privacy\tests\provider_testcase {
|
37 |
/**
|
37 |
/**
|
38 |
* Ensure that export_user_preferences returns no data if the user has not visited the myoverview block.
|
38 |
* Ensure that export_user_preferences returns no data if the user has not visited the myoverview block.
|
39 |
*/
|
39 |
*/
|
40 |
public function test_export_user_preferences_no_pref() {
|
40 |
public function test_export_user_preferences_no_pref(): void {
|
41 |
$this->resetAfterTest();
|
41 |
$this->resetAfterTest();
|
42 |
$user = $this->getDataGenerator()->create_user();
|
42 |
$user = $this->getDataGenerator()->create_user();
|
43 |
provider::export_user_preferences($user->id);
|
43 |
provider::export_user_preferences($user->id);
|
44 |
$writer = writer::with_context(\context_system::instance());
|
44 |
$writer = writer::with_context(\context_system::instance());
|
45 |
$this->assertFalse($writer->has_any_data());
|
45 |
$this->assertFalse($writer->has_any_data());
|
Línea 51... |
Línea 51... |
51 |
* @param string $type The name of the user preference to get/set
|
51 |
* @param string $type The name of the user preference to get/set
|
52 |
* @param string $value The value you are storing
|
52 |
* @param string $value The value you are storing
|
53 |
*
|
53 |
*
|
54 |
* @dataProvider user_preference_provider
|
54 |
* @dataProvider user_preference_provider
|
55 |
*/
|
55 |
*/
|
56 |
public function test_export_user_preferences($type, $value, $expected) {
|
56 |
public function test_export_user_preferences($type, $value, $expected): void {
|
57 |
$this->resetAfterTest();
|
57 |
$this->resetAfterTest();
|
58 |
$user = $this->getDataGenerator()->create_user();
|
58 |
$user = $this->getDataGenerator()->create_user();
|
59 |
set_user_preference($type, $value, $user);
|
59 |
set_user_preference($type, $value, $user);
|
60 |
provider::export_user_preferences($user->id);
|
60 |
provider::export_user_preferences($user->id);
|
61 |
$writer = writer::with_context(\context_system::instance());
|
61 |
$writer = writer::with_context(\context_system::instance());
|
Línea 88... |
Línea 88... |
88 |
array('block_myoverview_user_view_preference', 'summary', ''),
|
88 |
array('block_myoverview_user_view_preference', 'summary', ''),
|
89 |
array('block_myoverview_user_paging_preference', 12, 12)
|
89 |
array('block_myoverview_user_paging_preference', 12, 12)
|
90 |
);
|
90 |
);
|
91 |
}
|
91 |
}
|
Línea 92... |
Línea 92... |
92 |
|
92 |
|
93 |
public function test_export_user_preferences_with_hidden_courses() {
|
93 |
public function test_export_user_preferences_with_hidden_courses(): void {
|
94 |
$this->resetAfterTest();
|
94 |
$this->resetAfterTest();
|
95 |
$user = $this->getDataGenerator()->create_user();
|
95 |
$user = $this->getDataGenerator()->create_user();
|
Línea 96... |
Línea 96... |
96 |
$name = "block_myoverview_hidden_course_1";
|
96 |
$name = "block_myoverview_hidden_course_1";
|