json('POST', '/api/qrcode/decode', [ 'qrcode' => '', ]) ->assertStatus(422); } /** * test decode an invalid QR code uplloaded via API * * @test */ // public function testDecodeInvalidQrcode() // { // $file = LocalFile::fake()->invalidQrcode(); // $response = $this->withHeaders([ // 'Content-Type' => 'multipart/form-data', // ]) // ->json('POST', '/api/qrcode/decode', [ // 'qrcode' => $file, // 'inputFormat' => 'fileUpload' // ]); // $response->assertStatus(422); // } /** * test Decode a qrcode via API * * @test */ public function testDecodeValidQrcode() { Options::store(array('useBasicQrcodeReader' => true)); $file = LocalFile::fake()->validQrcode(); $response = $this->withHeaders(['Content-Type' => 'multipart/form-data']) ->json('POST', '/api/qrcode/decode', [ 'qrcode' => $file, 'inputFormat' => 'fileUpload' ]); $response->assertStatus(200) ->assertJsonStructure([ 'uri', ]); } }