Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 70... Línea 70...
70
    }
70
    }
Línea 71... Línea 71...
71
 
71
 
72
    /**
72
    /**
73
     * Test for initialising field and data controllers
73
     * Test for initialising field and data controllers
74
     */
74
     */
75
    public function test_initialise() {
75
    public function test_initialise(): void {
76
        $f = \core_customfield\field_controller::create($this->cfields[1]->get('id'));
76
        $f = \core_customfield\field_controller::create($this->cfields[1]->get('id'));
Línea 77... Línea 77...
77
        $this->assertTrue($f instanceof field_controller);
77
        $this->assertTrue($f instanceof field_controller);
78
 
78
 
Línea 89... Línea 89...
89
    /**
89
    /**
90
     * Test for configuration form functions
90
     * Test for configuration form functions
91
     *
91
     *
92
     * Create a configuration form and submit it with the same values as in the field
92
     * Create a configuration form and submit it with the same values as in the field
93
     */
93
     */
94
    public function test_config_form() {
94
    public function test_config_form(): void {
95
        $this->setAdminUser();
95
        $this->setAdminUser();
96
        $submitdata = (array)$this->cfields[1]->to_record();
96
        $submitdata = (array)$this->cfields[1]->to_record();
97
        $submitdata['configdata'] = $this->cfields[1]->get('configdata');
97
        $submitdata['configdata'] = $this->cfields[1]->get('configdata');
Línea 98... Línea 98...
98
 
98
 
Línea 105... Línea 105...
105
    }
105
    }
Línea 106... Línea 106...
106
 
106
 
107
    /**
107
    /**
108
     * Test for instance form functions
108
     * Test for instance form functions
109
     */
109
     */
110
    public function test_instance_form() {
110
    public function test_instance_form(): void {
111
        global $CFG;
111
        global $CFG;
112
        require_once($CFG->dirroot . '/customfield/tests/fixtures/test_instance_form.php');
112
        require_once($CFG->dirroot . '/customfield/tests/fixtures/test_instance_form.php');
113
        $this->setAdminUser();
113
        $this->setAdminUser();
Línea 134... Línea 134...
134
    }
134
    }
Línea 135... Línea 135...
135
 
135
 
136
    /**
136
    /**
137
     * Test for min/max date validation
137
     * Test for min/max date validation
138
     */
138
     */
139
    public function test_instance_form_validation() {
139
    public function test_instance_form_validation(): void {
140
        $this->setAdminUser();
140
        $this->setAdminUser();
141
        $handler = $this->cfcat->get_handler();
141
        $handler = $this->cfcat->get_handler();
142
        $submitdata = (array)$this->courses[1];
142
        $submitdata = (array)$this->courses[1];
Línea 152... Línea 152...
152
    }
152
    }
Línea 153... Línea 153...
153
 
153
 
154
    /**
154
    /**
155
     * Test for data_controller::get_value and export_value
155
     * Test for data_controller::get_value and export_value
156
     */
156
     */
157
    public function test_get_export_value() {
157
    public function test_get_export_value(): void {
158
        $this->assertEquals(1546300800, $this->cfdata[1]->get_value());
158
        $this->assertEquals(1546300800, $this->cfdata[1]->get_value());
Línea 159... Línea 159...
159
        $this->assertStringMatchesFormat('%a 1 January 2019%a', $this->cfdata[1]->export_value());
159
        $this->assertStringMatchesFormat('%a 1 January 2019%a', $this->cfdata[1]->export_value());
160
 
160
 
Línea 187... Línea 187...
187
     * @param int $expected
187
     * @param int $expected
188
     * @return void
188
     * @return void
189
     *
189
     *
190
     * @dataProvider parse_value_provider
190
     * @dataProvider parse_value_provider
191
     */
191
     */
192
    public function test_parse_value(string $value, int $expected) {
192
    public function test_parse_value(string $value, int $expected): void {
193
        $this->assertSame($expected, $this->cfields[1]->parse_value($value));
193
        $this->assertSame($expected, $this->cfields[1]->parse_value($value));
194
    }
194
    }
Línea 195... Línea 195...
195
 
195
 
196
    /**
196
    /**
197
     * Deleting fields and data
197
     * Deleting fields and data
198
     */
198
     */
199
    public function test_delete() {
199
    public function test_delete(): void {
200
        $this->cfcat->get_handler()->delete_all();
200
        $this->cfcat->get_handler()->delete_all();
201
    }
201
    }