Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 44... Línea 44...
44
 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
44
 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
45
 *
45
 *
46
 * @covers \behat_form_text
46
 * @covers \behat_form_text
47
 * @covers \behat_form_field
47
 * @covers \behat_form_field
48
 */
48
 */
49
class behat_form_text_test extends \basic_testcase {
49
final class behat_form_text_test extends \basic_testcase {
Línea 50... Línea 50...
50
 
50
 
51
    /**
51
    /**
52
     * Data provider for the test_set_get_value() method.
52
     * Data provider for the test_set_get_value() method.
53
     *
53
     *
54
     * @return array of value and expectation pairs to be tested.
54
     * @return array of value and expectation pairs to be tested.
55
     */
55
     */
56
    public function provider_test_set_get_value() {
56
    public static function provider_test_set_get_value(): array {
57
        return [
57
        return [
58
            'null' => [null, null],
58
            'null' => [null, null],
59
            'int' => [3, 3],
59
            'int' => [3, 3],
60
            'float' => [3.14, 3.14],
60
            'float' => [3.14, 3.14],
Línea 66... Línea 66...
66
    /**
66
    /**
67
     * Test the set_value() and get_value() methods.
67
     * Test the set_value() and get_value() methods.
68
     *
68
     *
69
     * @param mixed $value value to be set.
69
     * @param mixed $value value to be set.
70
     * @param mixed $expectation value to be checked.
70
     * @param mixed $expectation value to be checked.
71
     * @dataProvider provider_test_set_get_value()
71
     * @dataProvider provider_test_set_get_value
72
     */
72
     */
73
    public function test_set_get_value($value, $expectation): void {
73
    public function test_set_get_value($value, $expectation): void {
74
        $session = $this->createMock(Session::class);
74
        $session = $this->createMock(Session::class);
75
        $node = $this->createMock(NodeElement::class);
75
        $node = $this->createMock(NodeElement::class);
76
        $node->method('getValue')->willReturn($value);
76
        $node->method('getValue')->willReturn($value);
Línea 83... Línea 83...
83
    /**
83
    /**
84
     * Data provider for the test_text_matches() method.
84
     * Data provider for the test_text_matches() method.
85
     *
85
     *
86
     * @return array of decsep, value, match and result pairs to be tested.
86
     * @return array of decsep, value, match and result pairs to be tested.
87
     */
87
     */
88
    public function provider_test_matches() {
88
    public static function provider_test_matches(): array {
89
        return [
89
        return [
90
            'lazy true' => ['.', 'hello', 'hello', true],
90
            'lazy true' => ['.', 'hello', 'hello', true],
91
            'lazy false' => ['.', 'hello', 'bye', false],
91
            'lazy false' => ['.', 'hello', 'bye', false],
92
            'float true' => ['.', '3.14', '3.1400', true],
92
            'float true' => ['.', '3.14', '3.1400', true],
93
            'float false' => ['.', '3.14', '3.1401', false],
93
            'float false' => ['.', '3.14', '3.1401', false],
Línea 111... Línea 111...
111
     *
111
     *
112
     * @param string $decsep decimal separator to use.
112
     * @param string $decsep decimal separator to use.
113
     * @param mixed $value value to be set.
113
     * @param mixed $value value to be set.
114
     * @param mixed $match value to be matched.
114
     * @param mixed $match value to be matched.
115
     * @param bool  $result expected return status of the function.
115
     * @param bool  $result expected return status of the function.
116
     * @dataProvider provider_test_matches()
116
     * @dataProvider provider_test_matches
117
     */
117
     */
118
    public function test_matches($decsep, $value, $match, $result): void {
118
    public function test_matches($decsep, $value, $match, $result): void {
119
        global $CFG;
119
        global $CFG;
Línea 120... Línea 120...
120
 
120