mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-06 18:49:57 +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->string('zip');
|
||||||
$table->integer('ticket_price');
|
$table->integer('ticket_price');
|
||||||
$table->integer('ticket_quantity');
|
$table->integer('ticket_quantity');
|
||||||
|
$table->string('poster_image_path');
|
||||||
$table->datetime('published_at')->nullable();
|
$table->datetime('published_at')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ use App\User;
|
|||||||
use App\Concert;
|
use App\Concert;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Http\Testing\File;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||||
|
|
||||||
class AddConcertTest extends TestCase
|
class AddConcertTest extends TestCase
|
||||||
@@ -367,4 +369,18 @@ class AddConcertTest extends TestCase
|
|||||||
$response->assertSessionHasErrors('ticket_quantity');
|
$response->assertSessionHasErrors('ticket_quantity');
|
||||||
$this->assertEquals(0, Concert::count());
|
$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