Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0a7477d

Browse filesBrowse files
committed
Test convert CompletionInput into string
1 parent 1b18a07 commit 0a7477d
Copy full SHA for 0a7477d

File tree

Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed

‎src/Symfony/Component/Console/Completion/CompletionInput.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Completion/CompletionInput.php
+1-1Lines 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
{

‎src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Completion/CompletionInputTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,19 @@ public static function provideFromStringData()
133133
yield ['bin/console cache:clear "multi word string"', ['bin/console', 'cache:clear', '"multi word string"']];
134134
yield ['bin/console cache:clear \'multi word string\'', ['bin/console', 'cache:clear', '\'multi word string\'']];
135135
}
136+
137+
public function testToString()
138+
{
139+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 0);
140+
$this->assertSame('foo| bar baz', (string) $input);
141+
142+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 1);
143+
$this->assertSame('foo bar| baz', (string) $input);
144+
145+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 2);
146+
$this->assertSame('foo bar baz|', (string) $input);
147+
148+
$input = CompletionInput::fromTokens(['foo', 'bar', 'baz'], 11);
149+
$this->assertSame('foo bar baz |', (string) $input);
150+
}
136151
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.