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); }); }
/** * Return the query * * @return \Wps\RequestBuilder */ protected function getQuery() { return WpsContainer::make('RequestBuilder', [$this->related])->setBaseResourceKey($this->key); }
/** * Create a new instance of the RequestBuilder. * * @return \Wps\RequestBuilder */ protected function newQuery() { return WpsContainer::make('RequestBuilder', [$this]); }
public static function make($alias, array $args = [[]]) { return WpsContainer::getInstance()->container->get($alias, $args); }