1
0
Fork 0

add FileEvent constructor, fix formatting

pull/319/head
Sara Itani 2017-03-01 01:57:17 -08:00
parent 616d74cc3f
commit fc19640bab
2 changed files with 12 additions and 4 deletions

View File

@ -20,4 +20,14 @@ class FileEvent
* @var int * @var int
*/ */
public $type; public $type;
/**
* @param string $uri
* @param int $type
*/
public function __construct(string $uri, int $type)
{
$this->uri = $uri;
$this->type = $type;
}
} }

View File

@ -22,12 +22,10 @@ class DidChangeWatchedFilesTest extends ServerTestCase
$loader = new PhpDocumentLoader(new FileSystemContentRetriever(), $projectIndex, $definitionResolver); $loader = new PhpDocumentLoader(new FileSystemContentRetriever(), $projectIndex, $definitionResolver);
$workspace = new Server\Workspace($client, $projectIndex, $dependenciesIndex, $sourceIndex, null, $loader, null); $workspace = new Server\Workspace($client, $projectIndex, $dependenciesIndex, $sourceIndex, null, $loader, null);
$fileEvent = new FileEvent(); $fileEvent = new FileEvent('my uri', FileChangeType::DELETED);
$fileEvent->uri = 'my uri';
$fileEvent->type = FileChangeType::DELETED;
$isDiagnosticsCleared = false; $isDiagnosticsCleared = false;
$writer->on('message', function (Message $message) use ($fileEvent, & $isDiagnosticsCleared) { $writer->on('message', function (Message $message) use ($fileEvent, &$isDiagnosticsCleared) {
if ($message->body->method === "textDocument/publishDiagnostics") { if ($message->body->method === "textDocument/publishDiagnostics") {
$this->assertEquals($message->body->params->uri, $fileEvent->uri); $this->assertEquals($message->body->params->uri, $fileEvent->uri);
$this->assertEquals($message->body->params->diagnostics, []); $this->assertEquals($message->body->params->diagnostics, []);