mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 03:04:05 +00:00
139 - Faking Uploads and File Systems
This commit is contained in:
@@ -27,6 +27,7 @@ class CreateConcertsTable extends Migration
|
||||
$table->string('zip');
|
||||
$table->integer('ticket_price');
|
||||
$table->integer('ticket_quantity');
|
||||
$table->string('poster_image_path');
|
||||
$table->datetime('published_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -6,6 +6,8 @@ use App\User;
|
||||
use App\Concert;
|
||||
use Carbon\Carbon;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Http\Testing\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class AddConcertTest extends TestCase
|
||||
@@ -367,4 +369,18 @@ class AddConcertTest extends TestCase
|
||||
$response->assertSessionHasErrors('ticket_quantity');
|
||||
$this->assertEquals(0, Concert::count());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function poster_image_is_uploaded_if_included()
|
||||
{
|
||||
Storage::fake('s3');
|
||||
$user = factory(User::class)->create();
|
||||
|
||||
$response = $this->actingAs($user)->post('/backstage/concerts', $this->validParams([
|
||||
'poster_image' => File::image('concert-poster.png'),
|
||||
]));
|
||||
|
||||
$this->assertNotNull(Concert::first()->poster_image_path);
|
||||
Storage::disk('s3')->assertExists(Concert::first()->poster_image_path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user