Changeset View
Changeset View
Standalone View
Standalone View
src/parser/__tests__/PhutilURITestCase.php
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | public function testURIGeneration() { | ||||
| $uri = new PhutilURI('http://example.com'); | $uri = new PhutilURI('http://example.com'); | ||||
| $uri->setPath('bar'); | $uri->setPath('bar'); | ||||
| $this->assertEqual('http://example.com/bar', $uri->__toString()); | $this->assertEqual('http://example.com/bar', $uri->__toString()); | ||||
| } | } | ||||
| public function testStrictURIParsingOfHosts() { | public function testStrictURIParsingOfHosts() { | ||||
| $uri = new PhutilURI('http://&/'); | $uri = new PhutilURI('http://&/'); | ||||
| $this->assertEqual('', $uri->getDomain()); | $this->assertEqual('', $uri->getDomain()); | ||||
| // See T12961 for more discussion of these hosts which begin with "-". | |||||
| $uri = new PhutilURI('ssh://-oProxyCommand/'); | |||||
| $this->assertEqual('', $uri->getDomain()); | |||||
| $uri = new PhutilURI('ssh://-oProxyCommand=curl/'); | |||||
| $this->assertEqual('', $uri->getDomain()); | |||||
| $uri = new PhutilURI('ssh://.com/'); | |||||
| $this->assertEqual('', $uri->getDomain()); | |||||
| // Make sure newlines are rejected. | |||||
| $uri = new PhutilURI("ssh://example.com\n.domain.us/"); | |||||
| $this->assertEqual('', $uri->getDomain()); | |||||
| $uri = new PhutilURI("ssh://example.com\n"); | |||||
| $this->assertEqual('', $uri->getDomain()); | |||||
| } | } | ||||
| public function testStrictURIParsingOfLeadingWhitespace() { | public function testStrictURIParsingOfLeadingWhitespace() { | ||||
| $uri = new PhutilURI(' http://example.com/'); | $uri = new PhutilURI(' http://example.com/'); | ||||
| $this->assertEqual('', $uri->getDomain()); | $this->assertEqual('', $uri->getDomain()); | ||||
| } | } | ||||
| public function testAppendPath() { | public function testAppendPath() { | ||||
| ▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines | |||||