Revert to use storage_path

This commit is contained in:
Gabriel Peixoto
2018-11-27 18:34:37 -03:00
parent 83bf8d513b
commit 1e7b7cc853
3 changed files with 2 additions and 33 deletions

View File

@@ -4,7 +4,6 @@ namespace Mpociot\ApiDoc\Tools\ResponseStrategies;
use Illuminate\Routing\Route;
use Mpociot\Reflection\DocBlock\Tag;
use Illuminate\Support\Facades\Storage;
/**
* Get a response from from a file in the docblock ( @responseFile ).
@@ -33,7 +32,7 @@ class ResponseFileStrategy
}
$responseFileTag = array_first($responseFileTags);
$json = json_decode(Storage::get($responseFileTag->getContent()), true);
$json = json_decode(file_get_contents(storage_path($responseFileTag->getContent()), true), true);
return response()->json($json);
}

View File

@@ -165,7 +165,7 @@ class TestController extends Controller
}
/**
* @responseFile response_test.json
* @responseFile app/response_test.json
*/
public function responseFileTag()
{

View File

@@ -288,36 +288,6 @@ abstract class GeneratorTestCase extends TestCase
Storage::delete('response_test.json');
}
/** @test */
public function can_parse_response_file_tag_using_another_filesystem_driver()
{
// Mocking
Storage::fake('s3');
// copy file to storage
$fixtureFileJson = file_get_contents(__DIR__.'/../Fixtures/response_test.json');
Storage::disk('s3')->put('response_test.json', $fixtureFileJson);
$route = $this->createRoute('GET', '/responseFileTag', 'responseFileTag');
// Exception, because the file is not on Local storage
$this->expectException(FileNotFoundException::class);
$this->generator->processRoute($route);
// Now, set the default config to s3
Config::set('filesystems.default', 's3');
$parsed = $this->generator->processRoute($route);
$this->assertTrue(is_array($parsed));
$this->assertArrayHasKey('showresponse', $parsed);
$this->assertTrue($parsed['showresponse']);
$this->assertSame(
$parsed['response'],
$fixtureFileJson
);
Storage::disk('s3')->delete('response_test.json');
}
/** @test */
public function uses_configured_settings_when_calling_route()
{