-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
{ | ||
return [ | ||
'Empty file' => [ | ||
yield 'Empty file' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using generator instead
$tester->textDocument()->open(self::EXAMPLE_URI, self::EXAMPLE_SOURCE); | ||
|
||
$promise = $tester->workspace()->executeCommand('generate', [self::EXAMPLE_URI, self::EXAMPLE_OFFSET]); | ||
return $builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add the command and open the text document with the test LS
|
||
self::assertNotNull($showMessage); | ||
self::assertEquals([ | ||
'type' => 2, | ||
'type' => MessageType::WARNING, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the message type constant instead of a magic number
|
||
$applyEdit = $rpcClient->transmitter()->filterByMethod('workspace/applyEdit')->shiftRequest(); | ||
$builder = $this->createTester($generateMethod); | ||
$builder->responseWatcher()->resolveLastResponse(new ApplyWorkspaceEditResponse(true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test LS can "respond" to requests.
|
||
class GenerateMethodCommandTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
const EXAMPLE_SOURCE = '<?php '; | ||
const EXAMPLE_URI = 'file:///file.php'; | ||
const EXAMPLE_OFFSET = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use constants instead of local vars (which are acting as constants)
$tester = $builder->build(); | ||
$tester->textDocument()->open(self::EXAMPLE_URI, self::EXAMPLE_SOURCE); | ||
|
||
$promise = $tester->workspace()->executeCommand('generate', [self::EXAMPLE_URI, self::EXAMPLE_OFFSET]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm ... this is not right
cc @BladeMF