Skip to content

Commit 435142a

Browse files
authored
Merge pull request #85 from clue-labs/tests
Improve test suite to test against legacy PHP 5.3 through PHP 7.3 and support PHPUnit 7
2 parents a5be795 + 0ca0932 commit 435142a

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ php:
55
- 5.4
66
- 5.5
77
- 5.6
8-
- 7
8+
- 7.0
9+
- 7.1
10+
- 7.2
11+
- 7.3
912
- hhvm # ignore errors, see below
1013

1114
# lock distro so future defaults will not break the build

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"require-dev": {
2727
"clue/arguments": "^2.0",
2828
"clue/commander": "^1.2",
29-
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
29+
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35"
3030
},
3131
"config": {
3232
"sort-packages": true

src/Readline.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(ReadableStreamInterface $input, WritableStreamInterf
6161
"\033[D" => 'onKeyLeft',
6262

6363
"\033[1~" => 'onKeyHome',
64-
"\033[2~" => 'onKeyInsert',
64+
// "\033[2~" => 'onKeyInsert',
6565
"\033[3~" => 'onKeyDelete',
6666
"\033[4~" => 'onKeyEnd',
6767

@@ -547,12 +547,6 @@ public function onKeyDelete()
547547
$this->deleteChar($this->linepos);
548548
}
549549

550-
/** @internal */
551-
public function onKeyInsert()
552-
{
553-
// TODO: toggle insert mode
554-
}
555-
556550
/** @internal */
557551
public function onKeyHome()
558552
{
@@ -838,6 +832,11 @@ protected function processLine($eol)
838832
$this->emit('data', array($line . $eol));
839833
}
840834

835+
/**
836+
* @param string $str
837+
* @return int
838+
* @codeCoverageIgnore
839+
*/
841840
private function strlen($str)
842841
{
843842
// prefer mb_strlen() if available
@@ -849,6 +848,13 @@ private function strlen($str)
849848
return strlen(preg_replace('/./us', '.', $str));
850849
}
851850

851+
/**
852+
* @param string $str
853+
* @param int $start
854+
* @param ?int $len
855+
* @return string
856+
* @codeCoverageIgnore
857+
*/
852858
private function substr($str, $start = 0, $len = null)
853859
{
854860
if ($len === null) {
@@ -866,7 +872,12 @@ private function substr($str, $start = 0, $len = null)
866872
return implode('', array_slice($matches[0], $start, $len));
867873
}
868874

869-
/** @internal */
875+
/**
876+
* @internal
877+
* @param string $str
878+
* @return int
879+
* @codeCoverageIgnore
880+
*/
870881
public function strwidth($str)
871882
{
872883
// prefer mb_strwidth() if available
@@ -891,6 +902,10 @@ public function strwidth($str)
891902
));
892903
}
893904

905+
/**
906+
* @param string $str
907+
* @return string[]
908+
*/
894909
private function strsplit($str)
895910
{
896911
return preg_split('//u', $str, null, PREG_SPLIT_NO_EMPTY);

0 commit comments

Comments
 (0)