Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 35... Línea 35...
35
    /**
35
    /**
36
     * A userlist_collection should support the userlist type.
36
     * A userlist_collection should support the userlist type.
37
     *
37
     *
38
     * @covers ::add_userlist
38
     * @covers ::add_userlist
39
     */
39
     */
40
    public function test_supports_userlist() {
40
    public function test_supports_userlist(): void {
41
        $cut = \context_system::instance();
41
        $cut = \context_system::instance();
42
        $uut = new userlist_collection($cut);
42
        $uut = new userlist_collection($cut);
Línea 43... Línea 43...
43
 
43
 
44
        $userlist = new userlist($cut, 'core_privacy');
44
        $userlist = new userlist($cut, 'core_privacy');
Línea 50... Línea 50...
50
    /**
50
    /**
51
     * A userlist_collection should support the approved_userlist type.
51
     * A userlist_collection should support the approved_userlist type.
52
     *
52
     *
53
     * @covers ::add_userlist
53
     * @covers ::add_userlist
54
     */
54
     */
55
    public function test_supports_approved_userlist() {
55
    public function test_supports_approved_userlist(): void {
56
        $cut = \context_system::instance();
56
        $cut = \context_system::instance();
57
        $uut = new userlist_collection($cut);
57
        $uut = new userlist_collection($cut);
Línea 58... Línea 58...
58
 
58
 
59
        $userlist = new approved_userlist($cut, 'core_privacy', [1, 2, 3]);
59
        $userlist = new approved_userlist($cut, 'core_privacy', [1, 2, 3]);
Línea 65... Línea 65...
65
    /**
65
    /**
66
     * Ensure that get_userlist_for_component returns the correct userlist.
66
     * Ensure that get_userlist_for_component returns the correct userlist.
67
     *
67
     *
68
     * @covers ::get_userlist_for_component
68
     * @covers ::get_userlist_for_component
69
     */
69
     */
70
    public function test_get_userlist_for_component() {
70
    public function test_get_userlist_for_component(): void {
71
        $cut = \context_system::instance();
71
        $cut = \context_system::instance();
72
        $uut = new userlist_collection($cut);
72
        $uut = new userlist_collection($cut);
Línea 73... Línea 73...
73
 
73
 
74
        $privacy = new userlist($cut, 'core_privacy');
74
        $privacy = new userlist($cut, 'core_privacy');
Línea 86... Línea 86...
86
    /**
86
    /**
87
     * Ensure that get_userlist_for_component does not die horribly when querying a non-existent component.
87
     * Ensure that get_userlist_for_component does not die horribly when querying a non-existent component.
88
     *
88
     *
89
     * @covers ::get_userlist_for_component
89
     * @covers ::get_userlist_for_component
90
     */
90
     */
91
    public function test_get_userlist_for_component_not_found() {
91
    public function test_get_userlist_for_component_not_found(): void {
92
        $cut = \context_system::instance();
92
        $cut = \context_system::instance();
93
        $uut = new userlist_collection($cut);
93
        $uut = new userlist_collection($cut);
Línea 94... Línea 94...
94
 
94
 
95
        $this->assertNull($uut->get_userlist_for_component('core_tests'));
95
        $this->assertNull($uut->get_userlist_for_component('core_tests'));
Línea 98... Línea 98...
98
    /**
98
    /**
99
     * Ensure that a duplicate userlist in the collection throws an Exception.
99
     * Ensure that a duplicate userlist in the collection throws an Exception.
100
     *
100
     *
101
     * @covers ::add_userlist
101
     * @covers ::add_userlist
102
     */
102
     */
103
    public function test_duplicate_addition_throws() {
103
    public function test_duplicate_addition_throws(): void {
104
        $cut = \context_system::instance();
104
        $cut = \context_system::instance();
105
        $uut = new userlist_collection($cut);
105
        $uut = new userlist_collection($cut);
Línea 106... Línea 106...
106
 
106
 
107
        $userlist = new userlist($cut, 'core_privacy');
107
        $userlist = new userlist($cut, 'core_privacy');
Línea 114... Línea 114...
114
    /**
114
    /**
115
     * Ensure that the userlist_collection is countable.
115
     * Ensure that the userlist_collection is countable.
116
     *
116
     *
117
     * @covers ::count
117
     * @covers ::count
118
     */
118
     */
119
    public function test_countable() {
119
    public function test_countable(): void {
120
        $cut = \context_system::instance();
120
        $cut = \context_system::instance();
121
        $uut = new userlist_collection($cut);
121
        $uut = new userlist_collection($cut);
Línea 122... Línea 122...
122
 
122
 
123
        $uut->add_userlist(new userlist($cut, 'core_privacy'));
123
        $uut->add_userlist(new userlist($cut, 'core_privacy'));
Línea 133... Línea 133...
133
     * @covers ::key
133
     * @covers ::key
134
     * @covers ::next
134
     * @covers ::next
135
     * @covers ::rewind
135
     * @covers ::rewind
136
     * @covers ::valid
136
     * @covers ::valid
137
     */
137
     */
138
    public function test_iteration() {
138
    public function test_iteration(): void {
139
        $cut = \context_system::instance();
139
        $cut = \context_system::instance();
140
        $uut = new userlist_collection($cut);
140
        $uut = new userlist_collection($cut);
Línea 141... Línea 141...
141
 
141
 
Línea 163... Línea 163...
163
    /**
163
    /**
164
     * Test that the context is correctly returned.
164
     * Test that the context is correctly returned.
165
     *
165
     *
166
     * @covers ::get_context
166
     * @covers ::get_context
167
     */
167
     */
168
    public function test_get_context() {
168
    public function test_get_context(): void {
169
        $cut = \context_system::instance();
169
        $cut = \context_system::instance();
170
        $uut = new userlist_collection($cut);
170
        $uut = new userlist_collection($cut);
Línea 171... Línea 171...
171
 
171
 
172
        $this->assertSame($cut, $uut->get_context());
172
        $this->assertSame($cut, $uut->get_context());