createWithContent("美女养成师.txt",$content); $response = $this->postJson("api/contentManage/book/import",[ 'cp_id'=>1, 'cp_name'=>'Testcp01111', 'book_name'=>'美女养成师师', 'author'=>'小林', 'channel'=>1, 'category_id'=>21, 'category_name'=>'武侠仙侠', 'vip_start'=>4, 'file'=>$file ]); print_r(json_decode($response->getContent(),1)); $response->assertStatus(200); } public function test_create_book(): void { $path = 'book/NqpYgFL6yddDPSOnAwhIihk0DRjO7hEbOY3geJ6s.txt'; $response = $this->postJson("api/contentManage/book/createBook",[ 'cp_id'=>1, 'cp_name'=>'Testcp01111', 'book_name'=>'美女养成的师师', 'author'=>'小林', 'channel'=>1, 'category_id'=>21, 'category_name'=>'武侠仙侠', 'vip_start'=>4, 'path'=>$path ]); print_r(json_decode($response->getContent(),1)); $response->assertStatus(200); } private $token; protected function setUp(): void { parent::setUp(); // TODO: Change the autogenerated stub $tokenInfo = $this->post('http://localhost/api/login', [ 'email' => 'catch@admin.com', 'password' => 'catchadmin', 'remember' => false ])->json(); $this->token = $tokenInfo['data']['token']; } public function testList() { $res = $this->withHeaders([ 'Authorization' => 'Bearer '. $this->token, ])->json('get', 'http://localhost/api/contentManage/book/list?is_export=1'); $res->dump(); } }