Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 53... Línea 53...
53
            ->onlyMethods([
53
            ->onlyMethods([
54
                'get_locale',
54
                'get_locale',
55
                'set_locale',
55
                'set_locale',
56
            ])
56
            ])
57
            ->getMock();
57
            ->getMock();
58
        $mock->method('get_locale')->will($this->onConsecutiveCalls('en'));
58
        $mock->method('get_locale')->will($this->returnValue('en'));
-
 
59
        $setinvocations = $this->exactly(2);
-
 
60
        $mock
-
 
61
            ->expects($setinvocations)
59
        $mock->method('set_locale')->will($this->onConsecutiveCalls('es', 'en'));
62
            ->method('set_locale')->willReturnCallback(fn () => match (self::getInvocationCount($setinvocations)) {
-
 
63
                1 => 'es',
-
 
64
                2 => 'en',
-
 
65
            });
Línea 60... Línea 66...
60
 
66
 
61
        // Test what happen when locale is available on system.
67
        // Test what happen when locale is available on system.
62
        $result = $mock->check_locale_availability('en');
68
        $result = $mock->check_locale_availability('en');
Línea 70... Línea 76...
70
            ->onlyMethods([
76
            ->onlyMethods([
71
                'get_locale',
77
                'get_locale',
72
                'set_locale',
78
                'set_locale',
73
            ])
79
            ])
74
            ->getMock();
80
            ->getMock();
75
        $mock->method('get_locale')->will($this->onConsecutiveCalls('en'));
81
        $mock->expects($this->exactly(1))->method('get_locale')->will($this->returnValue('en'));
-
 
82
        $setinvocations = $this->exactly(2);
-
 
83
        $mock
-
 
84
            ->expects($setinvocations)
76
        $mock->method('set_locale')->will($this->onConsecutiveCalls(false, 'en'));
85
            ->method('set_locale')->willReturnCallback(fn () => match (self::getInvocationCount($setinvocations)) {
-
 
86
                1 => false,
-
 
87
                2 => 'en',
-
 
88
            });
Línea 77... Línea 89...
77
 
89
 
78
        // Test what happen when locale is not available on system.
90
        // Test what happen when locale is not available on system.
79
        $result = $mock->check_locale_availability('en');
91
        $result = $mock->check_locale_availability('en');