示例#1
0
 public function addMockResults(array $results, callable $onFulfilled = null, callable $onRejected = null)
 {
     $mock = new MockHandler($results, $onFulfilled, $onRejected);
     $handler = HandlerStack::create($mock);
     $handler->push(Middleware::history($this->history));
     $container = WpsContainer::getInstance();
     $container->container->add('WpsClient', function () use($handler) {
         return WpsClient::factory(['base_uri' => '/', 'defaults' => ['headers' => ['Content-Type' => 'application/json']], 'handler' => $handler], true);
     });
 }
示例#2
0
 /**
  * Return the query
  *
  * @return \Wps\RequestBuilder
  */
 protected function getQuery()
 {
     return WpsContainer::make('RequestBuilder', [$this->related])->setBaseResourceKey($this->key);
 }
示例#3
0
 /**
  * Create a new instance of the RequestBuilder.
  *
  * @return \Wps\RequestBuilder
  */
 protected function newQuery()
 {
     return WpsContainer::make('RequestBuilder', [$this]);
 }
示例#4
0
 public static function make($alias, array $args = [[]])
 {
     return WpsContainer::getInstance()->container->get($alias, $args);
 }