Skip to content

Commit 0aa29ca

Browse files
Merge branch '7.0' into 7.1
* 7.0: Allow service locators to be ordered by priority. [Filesystem][Mime] Fix transient tests Test convert CompletionInput into string
2 parents 9b008f2 + 6de397c commit 0aa29ca

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Completion/CompletionInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromString(string $inputStr, int $currentIndex): self
5353
* Create an input based on an COMP_WORDS token list.
5454
*
5555
* @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
56-
* @param $currentIndex the index of the cursor (e.g. COMP_CWORD)
56+
* @param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
5757
*/
5858
public static function fromTokens(array $tokens, int $currentIndex): self
5959
{

Tests/Completion/CompletionInputTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,19 @@ public static function provideFromStringData()
132132
yield ['bin/console cache:clear "multi word string"', ['bin/console', 'cache:clear', '"multi word string"']];
133133
yield ['bin/console cache:clear \'multi word string\'', ['bin/console', 'cache:clear', '\'multi word string\'']];
134134
}
135+
136+
public function testToString()
137+
{
138+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 0);
139+
$this->assertSame('foo| bar baz', (string) $input);
140+
141+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 1);
142+
$this->assertSame('foo bar| baz', (string) $input);
143+
144+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 2);
145+
$this->assertSame('foo bar baz|', (string) $input);
146+
147+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 11);
148+
$this->assertSame('foo bar baz |', (string) $input);
149+
}
135150
}

0 commit comments

Comments
 (0)