我正在尝试通过 PhpUnit 学习 API 测试。我无法理解它的流程?

I am trying to learn API testing through PhpUnit. I am not able to understand it's flow?

我遇到了以下代码,我只想问几个与该代码相关的问题,以便我可以编写自己的代码?

密码是

<?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'?

base_uri 是进行测试的 uri。在这种情况下 http://bookstore.com. In your function testGet_ValidInput_BookObject() you use get'/books' it will then look in http://bookstore.com/books.