Exemplo n.º 1
0
 public function testShouldUseBothMethodsAndParam()
 {
     $path = "/a/:dog/:abc/123";
     $expected = "/a/dog-value/abc-value/123";
     $actual = PathBuilder::build($path, $this->object, $this->params);
     $this->assertSame($expected, $actual);
 }
Exemplo n.º 2
0
 public function __construct($method, $path, $params, $headers, $object)
 {
     $this->apiBase = $this->apiBase ? $this->apiBase : Alman::getApiBase();
     $this->method = $method;
     $this->path = PathBuilder::build($path, $object, $params);
     $this->params = ParamsBuilder::build($params);
     $this->headers = HeadersBuilder::build($headers);
 }
 public function testShouldUsePathBuilder()
 {
     // Setup
     $method = "get";
     $path = "/testing";
     $params = ["param_a" => "1"];
     $headers = ["header_a" => "a"];
     $object = new \stdClass();
     $apiMethod = new ApiMethod($method, $path, $params, $headers, $object);
     // Assert Equals
     $this->assertSame(PathBuilder::build($path, $object, $params), $apiMethod->path);
 }
Exemplo n.º 4
0
 function build($id)
 {
     $this->items = array();
     $this->path = "";
     $this->pathFile = "";
     $this->htmlCode = "";
     parent::build($id);
     for ($i = 0; $i < sizeof($this->items); $i++) {
         $path = $this->basePath . $this->getPath($i);
         $item = $this->items[$i];
         if ($i < sizeof($this->items) - 1) {
             $this->htmlCode .= "<a href=\"{$path}\" {$this->linkAttrs} >{$item}</a>\n\t\t\t\t\t&nbsp;&gt;&nbsp;";
         } else {
             $this->htmlCode .= $item;
         }
     }
 }