返回true
$response = $this->json('POST', '/api/languages');
$this->assertEquals(["es", "ca", "en"], $response->response->getData());
但是这个假的
$this->json('POST', '/api/languages')->seeJson(["es", "ca", "en"]);
错误消息:
tests\ApiLanguageTest::testApiLanguage
Unable to find JSON fragment [["ca"]] within [["ca","en","es"]].
Failed asserting that false is true.
/home/vagrant/www/lumen-api/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php:283
/home/vagrant/www/lumen-api/vendor/laravel/lumen-framework/src/Testing/Concerns/MakesHttpRequests.php:208
/home/vagrant/www/lumen-api/tests/ApiLanguageTest.php:21
之前我试过seeJson
:
$this->json('POST', '/api/version', ['name' => 'Foo'])
->seeJson(["result" => true,"message" => "Bar"]);
工作得很好,无法理解为什么语言失败