Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 29... Línea 29...
29
 * Test data generator
29
 * Test data generator
30
 *
30
 *
31
 * @copyright  2013 The Open University
31
 * @copyright  2013 The Open University
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 */
33
 */
34
class generator_test extends \advanced_testcase {
34
final class generator_test extends \advanced_testcase {
35
    public function test_create(): void {
35
    public function test_create(): void {
36
        global $DB;
36
        global $DB;
Línea 37... Línea 37...
37
 
37
 
38
        $this->resetAfterTest();
38
        $this->resetAfterTest();
Línea 39... Línea 39...
39
        $generator = $this->getDataGenerator()->get_plugin_generator('core_question');
39
        $generator = $this->getDataGenerator()->get_plugin_generator('core_question');
Línea 40... Línea 40...
40
 
40
 
41
        $count = $DB->count_records('question_categories');
41
        $count = $DB->count_records('question_categories');
42
 
42
 
43
        $cat = $generator->create_question_category();
43
        $cat = $generator->create_question_category();
Línea 44... Línea 44...
44
        $count += $count ? 1 : 2; // Calling $generator->create_question_category() for the first time
44
        $count += $count ? 1 : 3; // Calling $generator->create_question_category() for the first time
45
                                  // creates a Top category as well.
45
                                  // creates a Top and Default category as well.
46
        $this->assertEquals($count, $DB->count_records('question_categories'));
46
        $this->assertEquals($count, $DB->count_records('question_categories'));