/** * @expectedException \CvoTechnologies\Twitter\Webservice\Exception\UnknownStreamEndpointException */ public function testUnknownStreamEndpoint() { $query = new Query($this->webservice, new Endpoint()); $query->read(); $query->applyOptions(['streamEndpoint' => 'test123']); $this->webservice->execute($query); }
public function testGeneralReadSingle() { StreamWrapper::emulate(HttpEmulation::fromCallable(function (RequestInterface $request) { $this->assertEquals('GET', $request->getMethod()); $this->assertEquals('/1.1/statuses/list.json', $request->getUri()->getPath()); $this->assertEquals('id=1', $request->getUri()->getQuery()); return new \GuzzleHttp\Psr7\Response(200, [], json_encode(['id' => 1, 'text' => 'Status 1'])); })); $query = new Query($this->webservice, new Endpoint(['endpoint' => 'statuses', 'connection' => $this->webservice->driver()])); $query->read(); $query->where(['id' => 1]); $resultSet = $this->webservice->execute($query); $this->assertInstanceOf('Muffin\\Webservice\\ResultSet', $resultSet); $this->assertInstanceOf('Muffin\\Webservice\\Model\\Resource', $resultSet->first()); $this->assertEquals('Status 1', $resultSet->first()->text); $this->assertEquals(1, $resultSet->count()); }
/** * @expectedException \CvoTechnologies\Redmine\Webservice\Exception\MissingResultsException */ public function testReadMissingResults() { $this->webservice->driver()->client($this->_clientMock('get', '/issues.json', [], [], [], 200)); $query = new Query($this->webservice, new Endpoint(['connection' => new Connection(['name' => 'redmine', 'driver' => 'CvoTechnologies\\Redmine\\Webservice\\Driver\\Redmine']), 'endpoint' => 'issues', 'schema' => new Schema('issues')])); $query->read(); $this->webservice->execute($query); }