2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								<?php
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								declare(strict_types = 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-08 12:51:49 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								namespace LanguageServer\Tests\Server\TextDocument;
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-18 21:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								use LanguageServer\Tests\Server\ServerTestCase;
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								use LanguageServer\Tests\MockProtocolStream;
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-08 12:51:49 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								use LanguageServer\{Server, LanguageClient, Project};
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-18 21:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								use LanguageServer\Protocol\{TextDocumentIdentifier, SymbolInformation, SymbolKind, Position, Location, Range};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								use function LanguageServer\pathToUri;
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-18 21:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								class DocumentSymbolTest extends ServerTestCase
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-08 12:51:49 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    public function test()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    {
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        // Request symbols
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-18 21:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        $uri = pathToUri(realpath(__DIR__ . '/../../../fixtures/symbols.php'));
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-14 09:25:44 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        $result = $this->textDocument->documentSymbol(new TextDocumentIdentifier($uri))->wait();
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-24 17:35:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
										
									
								 | 
							
							
								        // @codingStandardsIgnoreStart
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        $this->assertEquals([
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-09 17:44:28 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TestNamespace',      SymbolKind::NAMESPACE,   $this->getDefinitionLocation('TestNamespace'),                                ''),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TEST_CONST',         SymbolKind::CONSTANT,    $this->getDefinitionLocation('TestNamespace\\TEST_CONST'),                    'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TestClass',          SymbolKind::CLASS_,      $this->getDefinitionLocation('TestNamespace\\TestClass'),                     'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TEST_CLASS_CONST',   SymbolKind::CONSTANT,    $this->getDefinitionLocation('TestNamespace\\TestClass::TEST_CLASS_CONST'),   'TestNamespace\\TestClass'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('staticTestProperty', SymbolKind::PROPERTY,    $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestProperty'), 'TestNamespace\\TestClass'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('testProperty',       SymbolKind::PROPERTY,    $this->getDefinitionLocation('TestNamespace\\TestClass::testProperty'),       'TestNamespace\\TestClass'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('staticTestMethod',   SymbolKind::METHOD,      $this->getDefinitionLocation('TestNamespace\\TestClass::staticTestMethod()'), 'TestNamespace\\TestClass'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('testMethod',         SymbolKind::METHOD,      $this->getDefinitionLocation('TestNamespace\\TestClass::testMethod()'),       'TestNamespace\\TestClass'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TestTrait',          SymbolKind::CLASS_,      $this->getDefinitionLocation('TestNamespace\\TestTrait'),                     'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('TestInterface',      SymbolKind::INTERFACE,   $this->getDefinitionLocation('TestNamespace\\TestInterface'),                 'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('test_function',      SymbolKind::FUNCTION,    $this->getDefinitionLocation('TestNamespace\\test_function()'),               'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('ChildClass',         SymbolKind::CLASS_,      $this->getDefinitionLocation('TestNamespace\\ChildClass'),                    'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('Example',            SymbolKind::CLASS_,      $this->getDefinitionLocation('TestNamespace\\Example'),                       'TestNamespace'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('__construct',        SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__construct'),          'TestNamespace\\Example'),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								            new SymbolInformation('__destruct',         SymbolKind::CONSTRUCTOR, $this->getDefinitionLocation('TestNamespace\\Example::__destruct'),           'TestNamespace\\Example')
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-18 21:09:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        ], $result);
							 | 
						
					
						
							
								
									
										
										
										
											2016-10-24 17:35:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								        // @codingStandardsIgnoreEnd
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-02 19:13:30 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
								
									
								 | 
							
							
								}
							 |