Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 36... Línea 36...
36
     * Tests getting the factor total weight
36
     * Tests getting the factor total weight
37
     *
37
     *
38
     * @covers ::get_total_weight
38
     * @covers ::get_total_weight
39
     * @covers ::setup_user_factor
39
     * @covers ::setup_user_factor
40
     */
40
     */
41
    public function test_get_total_weight() {
41
    public function test_get_total_weight(): void {
42
        $this->resetAfterTest(true);
42
        $this->resetAfterTest(true);
Línea 43... Línea 43...
43
 
43
 
44
        // Create and login a user.
44
        // Create and login a user.
45
        $user = $this->getDataGenerator()->create_user();
45
        $user = $this->getDataGenerator()->create_user();
Línea 81... Línea 81...
81
    /**
81
    /**
82
     * Tests getting the factor status
82
     * Tests getting the factor status
83
     *
83
     *
84
     * @covers ::get_status
84
     * @covers ::get_status
85
     */
85
     */
86
    public function test_get_status() {
86
    public function test_get_status(): void {
87
        $this->resetAfterTest(true);
87
        $this->resetAfterTest(true);
Línea 88... Línea 88...
88
 
88
 
89
        // Create and login a user.
89
        // Create and login a user.
90
        $user = $this->getDataGenerator()->create_user();
90
        $user = $this->getDataGenerator()->create_user();
Línea 119... Línea 119...
119
    /**
119
    /**
120
     * Tests checking if passed enough factors
120
     * Tests checking if passed enough factors
121
     *
121
     *
122
     * @covers ::passed_enough_factors
122
     * @covers ::passed_enough_factors
123
     */
123
     */
124
    public function test_passed_enough_factors() {
124
    public function test_passed_enough_factors(): void {
125
        $this->resetAfterTest(true);
125
        $this->resetAfterTest(true);
Línea 126... Línea 126...
126
 
126
 
127
        // Create and login a user.
127
        // Create and login a user.
128
        $user = $this->getDataGenerator()->create_user();
128
        $user = $this->getDataGenerator()->create_user();
Línea 184... Línea 184...
184
     * @param string $webroot
184
     * @param string $webroot
185
     * @param bool $status
185
     * @param bool $status
186
     * @param array|null $params
186
     * @param array|null $params
187
     * @dataProvider should_redirect_urls_provider
187
     * @dataProvider should_redirect_urls_provider
188
     */
188
     */
189
    public function test_should_require_mfa_urls($urlstring, $webroot, $status, $params = null) {
189
    public function test_should_require_mfa_urls($urlstring, $webroot, $status, $params = null): void {
190
        $this->resetAfterTest(true);
190
        $this->resetAfterTest(true);
191
        global $CFG;
191
        global $CFG;
192
        $user = $this->getDataGenerator()->create_user();
192
        $user = $this->getDataGenerator()->create_user();
193
        $this->setUser($user);
193
        $this->setUser($user);
194
        $CFG->wwwroot = $webroot;
194
        $CFG->wwwroot = $webroot;
Línea 199... Línea 199...
199
    /**
199
    /**
200
     * Tests whether it should require the mfa checks
200
     * Tests whether it should require the mfa checks
201
     *
201
     *
202
     * @covers ::should_require_mfa
202
     * @covers ::should_require_mfa
203
     */
203
     */
204
    public function test_should_require_mfa_checks() {
204
    public function test_should_require_mfa_checks(): void {
205
        // Setup test and user.
205
        // Setup test and user.
206
        global $CFG;
206
        global $CFG;
207
        $this->resetAfterTest(true);
207
        $this->resetAfterTest(true);
208
        $user = $this->getDataGenerator()->create_user();
208
        $user = $this->getDataGenerator()->create_user();
Línea 271... Línea 271...
271
    /**
271
    /**
272
     * Tests should require the mfa redirection loop
272
     * Tests should require the mfa redirection loop
273
     *
273
     *
274
     * @covers ::should_require_mfa
274
     * @covers ::should_require_mfa
275
     */
275
     */
276
    public function test_should_require_mfa_redirection_loop() {
276
    public function test_should_require_mfa_redirection_loop(): void {
277
        // Setup test and user.
277
        // Setup test and user.
278
        global $CFG, $SESSION;
278
        global $CFG, $SESSION;
279
        $CFG->wwwroot = 'http://phpunit.test';
279
        $CFG->wwwroot = 'http://phpunit.test';
280
        $this->resetAfterTest(true);
280
        $this->resetAfterTest(true);
281
        $user = $this->getDataGenerator()->create_user();
281
        $user = $this->getDataGenerator()->create_user();
Línea 328... Línea 328...
328
     * Tests checking for possible setup factor
328
     * Tests checking for possible setup factor
329
     *
329
     *
330
     * @covers ::possible_factor_setup
330
     * @covers ::possible_factor_setup
331
     * @covers ::setup_user_factor
331
     * @covers ::setup_user_factor
332
     */
332
     */
333
    public function test_possible_factor_setup() {
333
    public function test_possible_factor_setup(): void {
334
        // Setup test and user.
334
        // Setup test and user.
335
        $this->resetAfterTest(true);
335
        $this->resetAfterTest(true);
336
        $user = $this->getDataGenerator()->create_user();
336
        $user = $this->getDataGenerator()->create_user();
337
        $this->setUser($user);
337
        $this->setUser($user);
Línea 363... Línea 363...
363
    /**
363
    /**
364
     * Tests checking if a factor is ready
364
     * Tests checking if a factor is ready
365
     *
365
     *
366
     * @covers ::is_ready
366
     * @covers ::is_ready
367
     */
367
     */
368
    public function test_is_ready() {
368
    public function test_is_ready(): void {
369
        // Setup test and user.
369
        // Setup test and user.
370
        global $CFG;
370
        global $CFG;
371
        $this->resetAfterTest(true);
371
        $this->resetAfterTest(true);
372
        $user = $this->getDataGenerator()->create_user();
372
        $user = $this->getDataGenerator()->create_user();
373
        $this->setUser($user);
373
        $this->setUser($user);
Línea 404... Línea 404...
404
     * Tests core hooks
404
     * Tests core hooks
405
     *
405
     *
406
     * @covers ::mfa_config_hook_test
406
     * @covers ::mfa_config_hook_test
407
     * @covers ::mfa_login_hook_test
407
     * @covers ::mfa_login_hook_test
408
     */
408
     */
409
    public function test_core_hooks() {
409
    public function test_core_hooks(): void {
410
        // Setup test and user.
410
        // Setup test and user.
411
        global $CFG, $SESSION;
411
        global $CFG, $SESSION;
412
        $this->resetAfterTest(true);
412
        $this->resetAfterTest(true);
413
        $user = $this->getDataGenerator()->create_user();
413
        $user = $this->getDataGenerator()->create_user();
414
        $this->setUser($user);
414
        $this->setUser($user);
Línea 423... Línea 423...
423
    /**
423
    /**
424
     * Tests circular redirect auth
424
     * Tests circular redirect auth
425
     *
425
     *
426
     * @covers ::should_require_mfa
426
     * @covers ::should_require_mfa
427
     */
427
     */
428
    public function test_circular_redirect_auth() {
428
    public function test_circular_redirect_auth(): void {
429
        // Setup test and user.
429
        // Setup test and user.
430
        $this->resetAfterTest(true);
430
        $this->resetAfterTest(true);
431
        $user = $this->getDataGenerator()->create_user();
431
        $user = $this->getDataGenerator()->create_user();
432
        $this->setUser($user);
432
        $this->setUser($user);