【发布时间】:2016-11-13 01:55:14
【问题描述】:
我遇到了以下代码,我只想问一些与该代码相关的问题,以便我可以编写自己的代码?
代码是
<?php
require('vendor/autoload.php');
class BooksTest extends PHPUnit_Framework_TestCase
{
protected $client;
protected function setUp()
{
$this->client = new GuzzleHttp\Client([
'base_uri' => 'http://mybookstore.com'
]);
}
public function testGet_ValidInput_BookObject()
{
$response = $this->client->get('/books', [
'query' => [
'bookId' => 'hitchhikers-guide-to-the-galaxy'
]
]);
$this->assertEquals(200, $response->getStatusCode());
$data = json_decode($response->getBody(), true);
$this->assertArrayHasKey('bookId', $data);
$this->assertArrayHasKey('title', $data);
$this->assertArrayHasKey('author', $data);
$this->assertEquals(42, $data['price']);
}
}
我的问题是:
1> 'base_uri' => 'http://mybookstore.com' 是什么意思?
【问题讨论】:
-
要是documented somewhere就好了。
-
谢谢.......如果这是我的 uri link 那么我应该如何编写我的查询。