backend/tests/Feature/ImageServiceTest.php
/**
     * A basic feature test example.
     *
     * @return void
     */
A basic feature test example.
@return void
A basic feature test example . @return void
public function testImagePublicUrl()
    {
        $image = new ImageService();
        $path = Storage::put('test', UploadedFile::fake()->image('test.jpeg', 1024, 1024));
        Storage::assertExists($path);
        $url = $image->publicUrl('public/' . $path, 512, 512);
        $this->assertFalse(filter_var($url, FILTER_VALIDATE_URL) === false);
        Storage::deleteDirectory('test');
    }
public function testImagePublicUrl ( ) { $ image = new ImageService ( ) ; $ path = Storage :: put ( 'test' , UploadedFile :: fake ( ) -> image ( 'test.jpeg' , 1024 , 1024 ) ) ; Storage :: assertExists ( $ path ) ; $ url = $ image -> publicUrl ( 'public/' . $ path , 512 , 512 ) ; $ this -> assertFalse ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) ; Storage :: deleteDirectory ( 'test' ) ; }
A basic feature test example.
A basic feature test example .
// ImgProxy uses MinIO not Laravel storage/framework/testing/ directory. // failed to open stream: Connection refused // $this->get($url) //     ->assertOk() //     ->assertHeader('content-type', 'image/jpeg');