Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 19... Línea 19...
19
 *
19
 *
20
 * @package     core_privacy
20
 * @package     core_privacy
21
 * @category    test
21
 * @category    test
22
 * @copyright   2018 Andrew Nicols <andrew@nicols.co.uk>
22
 * @copyright   2018 Andrew Nicols <andrew@nicols.co.uk>
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 * @coversDefaultClass \core_privacy\local\legacy_polyfill
-
 
25
 */
24
 */
Línea 26... Línea 25...
26
 
25
 
Línea 27... Línea 26...
27
namespace core_privacy;
26
namespace core_privacy;
Línea 48... Línea 47...
48
     * Test that the null_provider polyfill works and that the static _get_reason can be
47
     * Test that the null_provider polyfill works and that the static _get_reason can be
49
     * successfully called.
48
     * successfully called.
50
     *
49
     *
51
     * @covers ::get_reason
50
     * @covers ::get_reason
52
     */
51
     */
53
    public function test_null_provider() {
52
    public function test_null_provider(): void {
54
        $this->assertEquals('thisisareason', test_legacy_polyfill_null_provider::get_reason());
53
        $this->assertEquals('thisisareason', test_legacy_polyfill_null_provider::get_reason());
55
    }
54
    }
Línea 56... Línea 55...
56
 
55
 
57
    /**
56
    /**
58
     * Test that the metdata\provider polyfill works and that the static _get_metadata can be
57
     * Test that the metdata\provider polyfill works and that the static _get_metadata can be
59
     * successfully called.
58
     * successfully called.
60
     *
59
     *
61
     * @covers ::get_metadata
60
     * @covers ::get_metadata
62
     */
61
     */
63
    public function test_metadata_provider() {
62
    public function test_metadata_provider(): void {
64
        $collection = new collection('core_privacy');
63
        $collection = new collection('core_privacy');
65
        $this->assertSame($collection, test_legacy_polyfill_metadata_provider::get_metadata($collection));
64
        $this->assertSame($collection, test_legacy_polyfill_metadata_provider::get_metadata($collection));
Línea 66... Línea 65...
66
    }
65
    }
67
 
66
 
68
    /**
67
    /**
69
     * Test that the local\request\user_preference_provider polyfill works and that the static
68
     * Test that the local\request\user_preference_provider polyfill works and that the static
70
     * _export_user_preferences can be successfully called.
69
     * _export_user_preferences can be successfully called.
71
     *
70
     *
72
     * @covers ::export_user_preferences
71
     * @covers ::export_user_preferences
73
     */
72
     */
Línea 74... Línea 73...
74
    public function test_user_preference_provider() {
73
    public function test_user_preference_provider(): void {
75
        $userid = 417;
74
        $userid = 417;
76
 
75
 
Línea 87... Línea 86...
87
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
86
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
88
     * _get_contexts_for_userid can be successfully called.
87
     * _get_contexts_for_userid can be successfully called.
89
     *
88
     *
90
     * @covers ::get_contexts_for_userid
89
     * @covers ::get_contexts_for_userid
91
     */
90
     */
92
    public function test_get_contexts_for_userid() {
91
    public function test_get_contexts_for_userid(): void {
93
        $userid = 417;
92
        $userid = 417;
94
        $contextlist = new contextlist('core_privacy');
93
        $contextlist = new contextlist('core_privacy');
Línea 95... Línea 94...
95
 
94
 
96
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
95
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
Línea 108... Línea 107...
108
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
107
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
109
     * _export_user_data can be successfully called.
108
     * _export_user_data can be successfully called.
110
     *
109
     *
111
     * @covers ::export_user_data
110
     * @covers ::export_user_data
112
     */
111
     */
113
    public function test_export_user_data() {
112
    public function test_export_user_data(): void {
114
        $contextlist = new approved_contextlist(\core_user::get_user_by_username('admin'), 'core_privacy', [98]);
113
        $contextlist = new approved_contextlist(\core_user::get_user_by_username('admin'), 'core_privacy', [98]);
Línea 115... Línea 114...
115
 
114
 
116
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
115
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
117
        $mock->expects($this->once())
116
        $mock->expects($this->once())
Línea 126... Línea 125...
126
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
125
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
127
     * _delete_data_for_all_users_in_context can be successfully called.
126
     * _delete_data_for_all_users_in_context can be successfully called.
128
     *
127
     *
129
     * @covers ::delete_data_for_all_users_in_context
128
     * @covers ::delete_data_for_all_users_in_context
130
     */
129
     */
131
    public function test_delete_data_for_all_users_in_context() {
130
    public function test_delete_data_for_all_users_in_context(): void {
132
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
131
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
133
        $mock->expects($this->once())
132
        $mock->expects($this->once())
134
            ->method('get_return_value')
133
            ->method('get_return_value')
135
            ->with('_delete_data_for_all_users_in_context', [\context_system::instance()]);
134
            ->with('_delete_data_for_all_users_in_context', [\context_system::instance()]);
Línea 142... Línea 141...
142
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
141
     * Test that the local\request\core_user_preference_provider polyfill works and that the static
143
     * _delete_data_for_user can be successfully called.
142
     * _delete_data_for_user can be successfully called.
144
     *
143
     *
145
     * @covers ::delete_data_for_user
144
     * @covers ::delete_data_for_user
146
     */
145
     */
147
    public function test_delete_data_for_user() {
146
    public function test_delete_data_for_user(): void {
148
        $contextlist = new approved_contextlist(\core_user::get_user_by_username('admin'), 'core_privacy', [98]);
147
        $contextlist = new approved_contextlist(\core_user::get_user_by_username('admin'), 'core_privacy', [98]);
Línea 149... Línea 148...
149
 
148
 
150
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
149
        $mock = $this->createMock(test_legacy_polyfill_mock_wrapper::class);
151
        $mock->expects($this->once())
150
        $mock->expects($this->once())