@@ -42,6 +42,25 @@ public function testSettingInputMovesCursorToEnd()
42
42
$ this ->assertEquals (7 , $ this ->readline ->getCursorCell ());
43
43
}
44
44
45
+ public function testSettingMoveOffDoesNotAllowDirectionKeysToChangePosition ()
46
+ {
47
+ $ this ->readline ->setInput ('test ' );
48
+ $ this ->readline ->setMove (false );
49
+ $ this ->readline ->moveCursorTo (2 );
50
+
51
+ $ this ->readline ->onKeyLeft ();
52
+ $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
53
+
54
+ $ this ->readline ->onKeyRight ();
55
+ $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
56
+
57
+ $ this ->readline ->onKeyHome ();
58
+ $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
59
+
60
+ $ this ->readline ->onKeyEnd ();
61
+ $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
62
+ }
63
+
45
64
public function testMultiByteInput ()
46
65
{
47
66
$ this ->readline ->setInput ('täst ' );
@@ -192,6 +211,32 @@ public function testKeysEndMovesToEnd(Readline $readline)
192
211
$ readline ->onKeyEnd ();
193
212
194
213
$ this ->assertEquals (4 , $ readline ->getCursorPosition ());
214
+
215
+ return $ readline ;
216
+ }
217
+
218
+ /**
219
+ * @depends testKeysEndMovesToEnd
220
+ * @param Readline $readline
221
+ */
222
+ public function testKeysLeftMovesToLeft (Readline $ readline )
223
+ {
224
+ $ readline ->onKeyLeft ();
225
+
226
+ $ this ->assertEquals (3 , $ readline ->getCursorPosition ());
227
+
228
+ return $ readline ;
229
+ }
230
+
231
+ /**
232
+ * @depends testKeysLeftMovesToLeft
233
+ * @param Readline $readline
234
+ */
235
+ public function testKeysRightMovesToRight (Readline $ readline )
236
+ {
237
+ $ readline ->onKeyRight ();
238
+
239
+ $ this ->assertEquals (4 , $ readline ->getCursorPosition ());
195
240
}
196
241
197
242
public function testKeysSimpleChars ()
0 commit comments