Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 44... Línea 44...
44
     * @param   array   $input List of context IDs
44
     * @param   array   $input List of context IDs
45
     * @param   array   $expected list of contextids
45
     * @param   array   $expected list of contextids
46
     * @param   int     $count Expected count
46
     * @param   int     $count Expected count
47
     * @covers ::get_contextids
47
     * @covers ::get_contextids
48
     */
48
     */
49
    public function test_get_contextids($input, $expected, $count) {
49
    public function test_get_contextids($input, $expected, $count): void {
50
        $uit = new test_contextlist_base();
50
        $uit = new test_contextlist_base();
51
        $uit->set_contextids($input);
51
        $uit->set_contextids($input);
Línea 52... Línea 52...
52
 
52
 
53
        $result = $uit->get_contextids();
53
        $result = $uit->get_contextids();
Línea 87... Línea 87...
87
    /**
87
    /**
88
     * Ensure that get_contexts returns the correct list of contexts.
88
     * Ensure that get_contexts returns the correct list of contexts.
89
     *
89
     *
90
     * @covers ::get_contexts
90
     * @covers ::get_contexts
91
     */
91
     */
92
    public function test_get_contexts() {
92
    public function test_get_contexts(): void {
93
        global $DB;
93
        global $DB;
Línea 94... Línea 94...
94
 
94
 
95
        $contexts = [];
95
        $contexts = [];
96
        $contexts[] = \context_system::instance();
96
        $contexts[] = \context_system::instance();
Línea 118... Línea 118...
118
     * @param   array   $input List of context IDs
118
     * @param   array   $input List of context IDs
119
     * @param   array   $expected list of contextids
119
     * @param   array   $expected list of contextids
120
     * @param   int     $count Expected count
120
     * @param   int     $count Expected count
121
     * @covers ::count
121
     * @covers ::count
122
     */
122
     */
123
    public function test_countable($input, $expected, $count) {
123
    public function test_countable($input, $expected, $count): void {
124
        $uit = new test_contextlist_base();
124
        $uit = new test_contextlist_base();
125
        $uit->set_contextids($input);
125
        $uit->set_contextids($input);
Línea 126... Línea 126...
126
 
126
 
127
        $this->assertCount($count, $uit);
127
        $this->assertCount($count, $uit);
Línea 134... Línea 134...
134
     * @covers ::key
134
     * @covers ::key
135
     * @covers ::next
135
     * @covers ::next
136
     * @covers ::rewind
136
     * @covers ::rewind
137
     * @covers ::valid
137
     * @covers ::valid
138
     */
138
     */
139
    public function test_context_iteration() {
139
    public function test_context_iteration(): void {
140
        global $DB;
140
        global $DB;
Línea 141... Línea 141...
141
 
141
 
142
        $allcontexts = $DB->get_records('context');
142
        $allcontexts = $DB->get_records('context');
143
        $contexts = [];
143
        $contexts = [];
Línea 156... Línea 156...
156
    /**
156
    /**
157
     * Test that deleting a context results in current returning nothing.
157
     * Test that deleting a context results in current returning nothing.
158
     *
158
     *
159
     * @covers ::current
159
     * @covers ::current
160
     */
160
     */
161
    public function test_current_context_one_context() {
161
    public function test_current_context_one_context(): void {
162
        global $DB;
162
        global $DB;
Línea 163... Línea 163...
163
 
163
 
Línea 164... Línea 164...
164
        $this->resetAfterTest();
164
        $this->resetAfterTest();
Línea 185... Línea 185...
185
    /**
185
    /**
186
     * Test that deleting a context results in the next record being returned.
186
     * Test that deleting a context results in the next record being returned.
187
     *
187
     *
188
     * @covers ::current
188
     * @covers ::current
189
     */
189
     */
190
    public function test_current_context_two_contexts() {
190
    public function test_current_context_two_contexts(): void {
191
        global $DB;
191
        global $DB;
Línea 192... Línea 192...
192
 
192
 
Línea 193... Línea 193...
193
        $this->resetAfterTest();
193
        $this->resetAfterTest();
Línea 222... Línea 222...
222
    /**
222
    /**
223
     * Test that if there are no non-deleted contexts that nothing is returned.
223
     * Test that if there are no non-deleted contexts that nothing is returned.
224
     *
224
     *
225
     * @covers ::get_contexts
225
     * @covers ::get_contexts
226
     */
226
     */
227
    public function test_get_contexts_all_deleted() {
227
    public function test_get_contexts_all_deleted(): void {
228
        global $DB;
228
        global $DB;
Línea 229... Línea 229...
229
 
229
 
Línea 230... Línea 230...
230
        $this->resetAfterTest();
230
        $this->resetAfterTest();
Línea 249... Línea 249...
249
    /**
249
    /**
250
     * Test that get_contexts() returns only active contexts.
250
     * Test that get_contexts() returns only active contexts.
251
     *
251
     *
252
     * @covers ::get_contexts
252
     * @covers ::get_contexts
253
     */
253
     */
254
    public function test_get_contexts_one_deleted() {
254
    public function test_get_contexts_one_deleted(): void {
255
        global $DB;
255
        global $DB;
Línea 256... Línea 256...
256
 
256
 
Línea 257... Línea 257...
257
        $this->resetAfterTest();
257
        $this->resetAfterTest();