1 | <?php |
||
18 | class MonolingualTextValueTest extends DataValueTest { |
||
19 | |||
20 | /** |
||
21 | * @see DataValueTest::getClass |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | public function getClass() { |
||
28 | |||
29 | public function validConstructorArgumentsProvider() { |
||
30 | return [ |
||
31 | [ 'en', 'foo' ], |
||
32 | [ 'en', ' foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz ' ], |
||
33 | ]; |
||
34 | } |
||
35 | |||
36 | public function invalidConstructorArgumentsProvider() { |
||
37 | return [ |
||
38 | [ 42, null ], |
||
39 | [ [], null ], |
||
40 | [ false, null ], |
||
41 | [ true, null ], |
||
42 | [ null, null ], |
||
43 | [ 'en', 42 ], |
||
44 | [ 'en', false ], |
||
45 | [ 'en', [] ], |
||
46 | [ 'en', null ], |
||
47 | [ '', 'foo' ], |
||
48 | ]; |
||
49 | } |
||
50 | |||
51 | public function testNewFromArray() { |
||
52 | $array = [ 'text' => 'foo', 'language' => 'en' ]; |
||
53 | $value = MonolingualTextValue::newFromArray( $array ); |
||
|
|||
54 | $this->assertSame( $array, $value->getArrayValue() ); |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @dataProvider invalidArrayProvider |
||
59 | */ |
||
60 | public function testNewFromArrayWithInvalidArray( array $array ) { |
||
61 | $this->setExpectedException( 'DataValues\IllegalValueException' ); |
||
62 | MonolingualTextValue::newFromArray( $array ); |
||
63 | } |
||
64 | |||
65 | public function invalidArrayProvider() { |
||
66 | return [ |
||
67 | [ [] ], |
||
68 | [ [ null ] ], |
||
69 | [ [ '' ] ], |
||
70 | [ [ 'en', 'foo' ] ], |
||
71 | [ [ 'language' => 'en' ] ], |
||
72 | [ [ 'text' => 'foo' ] ], |
||
73 | ]; |
||
74 | } |
||
75 | |||
76 | public function testGetSortKey() { |
||
77 | $value = new MonolingualTextValue( 'en', 'foo' ); |
||
78 | $this->assertSame( 'enfoo', $value->getSortKey() ); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @dataProvider instanceProvider |
||
83 | */ |
||
84 | public function testGetText( MonolingualTextValue $text, array $arguments ) { |
||
87 | |||
88 | /** |
||
89 | * @dataProvider instanceProvider |
||
90 | */ |
||
91 | public function testGetLanguageCode( MonolingualTextValue $text, array $arguments ) { |
||
94 | |||
95 | } |
||
96 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.