Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 52... Línea 52...
52
    /**
52
    /**
53
     * Test that calling with_context multiple times will return the same write instance.
53
     * Test that calling with_context multiple times will return the same write instance.
54
     *
54
     *
55
     * @covers ::with_context
55
     * @covers ::with_context
56
     */
56
     */
57
    public function test_with_context() {
57
    public function test_with_context(): void {
58
        $writer = writer::with_context(\context_system::instance());
58
        $writer = writer::with_context(\context_system::instance());
Línea 59... Línea 59...
59
 
59
 
60
        $this->assertSame($writer, writer::with_context(\context_system::instance()));
60
        $this->assertSame($writer, writer::with_context(\context_system::instance()));
Línea 61... Línea 61...
61
    }
61
    }
62
 
62
 
63
    /**
63
    /**
64
     * Test that calling with_context multiple times will return the same write instance.
64
     * Test that calling with_context multiple times will return the same write instance.
65
     *
65
     *
66
     * @covers ::with_context
66
     * @covers ::with_context
67
     */
67
     */
Línea 68... Línea 68...
68
    public function test_with_context_different_context_same_instance() {
68
    public function test_with_context_different_context_same_instance(): void {
69
        $writer = writer::with_context(\context_system::instance());
69
        $writer = writer::with_context(\context_system::instance());
Línea 70... Línea 70...
70
 
70
 
71
        $this->assertSame($writer, writer::with_context(\context_user::instance(\core_user::get_user_by_username('admin')->id)));
71
        $this->assertSame($writer, writer::with_context(\context_user::instance(\core_user::get_user_by_username('admin')->id)));
72
    }
72
    }
73
 
73
 
74
    /**
74
    /**
75
     * Test that calling writer::reset() causes a new copy of the writer to be returned.
75
     * Test that calling writer::reset() causes a new copy of the writer to be returned.
76
     *
76
     *
77
     * @covers ::reset
77
     * @covers ::reset
Línea 78... Línea 78...
78
     */
78
     */
79
    public function test_reset() {
79
    public function test_reset(): void {
Línea 86... Línea 86...
86
    /**
86
    /**
87
     * Test that the export_user_preference calls the writer against the system context.
87
     * Test that the export_user_preference calls the writer against the system context.
88
     *
88
     *
89
     * @covers ::export_user_preference
89
     * @covers ::export_user_preference
90
     */
90
     */
91
    public function test_export_user_preference_sets_system_context() {
91
    public function test_export_user_preference_sets_system_context(): void {
92
        $writer = writer::with_context(\context_user::instance(\core_user::get_user_by_username('admin')->id));
92
        $writer = writer::with_context(\context_user::instance(\core_user::get_user_by_username('admin')->id));
Línea 93... Línea 93...
93
 
93
 
Línea 94... Línea 94...
94
        writer::export_user_preference('core_test', 'key', 'value', 'description');
94
        writer::export_user_preference('core_test', 'key', 'value', 'description');