testPrefix passing
This commit is contained in:
parent
72b1a44e38
commit
29e22a0a2e
@ -82,14 +82,15 @@ class WampConnection extends AbstractConnectionDecorator {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getUri($uri) {
|
public function getUri($uri) {
|
||||||
$seperator = ':';
|
$curieSeperator = ':';
|
||||||
|
$fullSeperator = '#';
|
||||||
|
|
||||||
if(preg_match('/http(s*)\:\/\//', $uri) === false){
|
if(preg_match('/http(s*)\:\/\//', $uri) == false){
|
||||||
if(strpos($uri, $seperator) !== false){
|
if(strpos($uri, $curieSeperator) !== false){
|
||||||
list($prefix, $action) = explode(':', $uri);
|
list($prefix, $action) = explode($curieSeperator, $uri);
|
||||||
$expandedPrefix = isset($this->WAMP->prefixes[$prefix]) ? $this->WAMP->prefixes[$prefix] : $prefix;
|
$expandedPrefix = isset($this->WAMP->prefixes[$prefix]) ? $this->WAMP->prefixes[$prefix] : $prefix;
|
||||||
|
|
||||||
return $expandedPrefix . '#' . $action;
|
return $expandedPrefix . $fullSeperator . $action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,13 +211,14 @@ class ServerProtocolTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$conn = new WampConnection($this->newConn());
|
$conn = new WampConnection($this->newConn());
|
||||||
$this->_comp->onOpen($conn);
|
$this->_comp->onOpen($conn);
|
||||||
|
|
||||||
$shortIn = 'incoming';
|
$prefix = 'incoming';
|
||||||
$longIn = 'http://example.com/incoming/';
|
$fullURI = "http://example.com/$prefix";
|
||||||
|
$method = 'call';
|
||||||
|
|
||||||
$this->_comp->onMessage($conn, json_encode(array(1, $shortIn, $longIn)));
|
$this->_comp->onMessage($conn, json_encode(array(1, $prefix, $fullURI)));
|
||||||
|
|
||||||
$this->assertEquals($longIn, $conn->WAMP->prefixes[$shortIn]);
|
$this->assertEquals($fullURI, $conn->WAMP->prefixes[$prefix]);
|
||||||
$this->assertEquals($longIn, $conn->getUri($shortIn));
|
$this->assertEquals("$fullURI#$method", $conn->getUri("$prefix:$method"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessageMustBeJson() {
|
public function testMessageMustBeJson() {
|
||||||
|
Loading…
Reference in New Issue
Block a user