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
 *
29
 *
30
 * @package core_calendar
30
 * @package core_calendar
31
 * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
31
 * @copyright 2017 Cameron Ball <cameron@cameron1729.xyz>
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 event_factory_test extends \advanced_testcase {
34
final class event_factory_test extends \advanced_testcase {
35
    /**
35
    /**
36
     * Test event class getters.
36
     * Test event class getters.
37
     *
37
     *
38
     * @dataProvider create_instance_testcases()
38
     * @dataProvider create_instance_testcases
39
     * @param \stdClass $dbrow Row from the event table.
39
     * @param \stdClass $dbrow Row from the event table.
40
     * @param callable  $actioncallbackapplier     Action callback applier.
40
     * @param callable  $actioncallbackapplier     Action callback applier.
41
     * @param callable  $visibilitycallbackapplier Visibility callback applier.
41
     * @param callable  $visibilitycallbackapplier Visibility callback applier.
42
     * @param callable  $bailoutcheck              Early bail out check function.
42
     * @param callable  $bailoutcheck              Early bail out check function.
43
     * @param string    $expectedclass             Class the factory is expected to produce.
43
     * @param string    $expectedclass             Class the factory is expected to produce.
Línea 344... Línea 344...
344
    /**
344
    /**
345
     * Testcases for the create instance test.
345
     * Testcases for the create instance test.
346
     *
346
     *
347
     * @return array Array of testcases.
347
     * @return array Array of testcases.
348
     */
348
     */
349
    public function create_instance_testcases() {
349
    public static function create_instance_testcases(): array {
350
        return [
350
        return [
351
            'Sample event record with event exposed' => [
351
            'Sample event record with event exposed' => [
352
                'dbrow' => (object)[
352
                'dbrow' => (object)[
353
                    'name' => 'Test event',
353
                    'name' => 'Test event',
354
                    'description' => 'Hello',
354
                    'description' => 'Hello',
Línea 377... Línea 377...
377
                    return true;
377
                    return true;
378
                },
378
                },
379
                'bailoutcheck' => function() {
379
                'bailoutcheck' => function() {
380
                    return false;
380
                    return false;
381
                },
381
                },
382
                event_interface::class,
382
                'expectedclass' => event_interface::class,
383
                'Hello'
383
                'expectedattributevalue' => 'Hello'
384
            ],
384
            ],
385
            'Sample event record with event hidden' => [
385
            'Sample event record with event hidden' => [
386
                'dbrow' => (object)[
386
                'dbrow' => (object)[
387
                    'name' => 'Test event',
387
                    'name' => 'Test event',
388
                    'description' => 'Hello',
388
                    'description' => 'Hello',
Línea 411... Línea 411...
411
                    return false;
411
                    return false;
412
                },
412
                },
413
                'bailoutcheck' => function() {
413
                'bailoutcheck' => function() {
414
                    return false;
414
                    return false;
415
                },
415
                },
416
                null,
416
                'expectedclass' => null,
417
                null
417
                'expectedattributevalue' => null
418
            ],
418
            ],
419
            'Sample event record with early bail' => [
419
            'Sample event record with early bail' => [
420
                'dbrow' => (object)[
420
                'dbrow' => (object)[
421
                    'name' => 'Test event',
421
                    'name' => 'Test event',
422
                    'description' => 'Hello',
422
                    'description' => 'Hello',
Línea 445... Línea 445...
445
                    return true;
445
                    return true;
446
                },
446
                },
447
                'bailoutcheck' => function() {
447
                'bailoutcheck' => function() {
448
                    return true;
448
                    return true;
449
                },
449
                },
450
                null,
450
                'expectedclass' => null,
451
                null
451
                'expectedattributevalue' => null
452
            ]
452
            ]
453
        ];
453
        ];
454
    }
454
    }
Línea 455... Línea 455...
455
 
455