newEngine(); $caught = null; try { $engine->setVersion($v); } catch (Exception $e) { $caught = $e; } $this->assertEqual( null, $caught, pht('Expected no exception for version=%d.', $v)); $this->assertEqual($v, $engine->getVersion()); } } public function testSetVersionRejectsBelowSeven() { foreach (array(0, 1, 2, 5, 6) as $v) { $engine = $this->newEngine(); $caught = null; try { $engine->setVersion($v); } catch (Exception $e) { $caught = $e; } $this->assertTrue( $caught !== null, pht('Expected an exception for version=%d.', $v)); } } public function testGetDocumentUri() { $engine = $this->newEngine()->setVersion(7); $uri = $engine->getDocumentUri('TASK', 'PHID-TASK-abc'); $this->assertEqual('/_doc/PHID-TASK-abc', $uri); } public function testGetDocumentUriIgnoresType() { // The typeless API does not encode the doc type in the URL. $engine = $this->newEngine()->setVersion(7); $uri_a = $engine->getDocumentUri('TASK', 'PHID-TASK-abc'); $uri_b = $engine->getDocumentUri('DREV', 'PHID-TASK-abc'); $this->assertEqual($uri_a, $uri_b); } }