/** * Send method. * To send a request, a client must be linked * @return \Bee4\Transport\Message\Response * @throws RuntimeException */ public function send() { if (!$this->client) { throw new RuntimeException('A client must be set on the request'); } if (null === $this->configuration->url) { $this->configuration->url = $this->getUrl()->toString(); } $this->prepare(); return $this->client->send($this); }
public function testCurlError() { $this->expectOutputString('error'); $this->object = new Client("ftp://127.0.0.1:8888"); $dispatcher = new EvenementEventEmitterAdapter(new EventEmitter()); $dispatcher->on(ErrorEvent::ERROR, function () { echo "error"; }); $this->object->setDispatcher($dispatcher); try { $this->object->createRequest('GET')->send(); } catch (\Exception $error) { $this->assertInstanceOf("\\Bee4\\Transport\\Exception\\CurlException", $error); return; } $this->fail(); }