Exemplo n.º 1
0
 /** @test */
 public function it_processes_a_form_to_add_a_photo_to_a_flyer()
 {
     $flyer = factory(Flyer::class)->create();
     $file = m::mock(UploadedFile::class, ['getClientOriginalExtension' => 'jpg', 'getClientOriginalName' => 'foo']);
     $file->shouldReceive('move')->once()->with('images/photos', 'nowfoo.jpg');
     $thumbnail = m::mock(Thumbnail::Class);
     $thumbnail->shouldReceive('make')->once()->with('images/photos/nowfoo.jpg', 'images/photos/tn-nowfoo.jpg');
     $form = new AddPhotoToFlyer($flyer, $file, $thumbnail);
     $form->save();
     $this->assertCount(1, $flyer->photos);
 }
Exemplo n.º 2
0
 /** @test */
 function test_it_()
 {
     $flyer = factory(Flyer::class)->create();
     $file = m::mock(UploadedFile::class, ['getClientOriginalName' => 'hey', 'getClientOriginalExtension' => 'jpg']);
     $file->shouldReceive('move')->once()->with('flyer_photos', 'nowhey.jpg');
     $thumbnail = m::mock(Thumbnail::class);
     $thumbnail->shouldReceive('make')->once()->with(1, 2);
     $form = new AddPhotoToFlyer($flyer, $file, $thumbnail);
     $form->save();
     $this->assertCount(1, $flyer->photos);
 }