Skip to content

Instantly share code, notes, and snippets.

@jsdecena
Created March 8, 2018 00:19
Show Gist options
  • Save jsdecena/3e1976ef88eca31b1127a4fddd882bdd to your computer and use it in GitHub Desktop.
Save jsdecena/3e1976ef88eca31b1127a4fddd882bdd to your computer and use it in GitHub Desktop.
Carousel Unit Test
<?php
namespace Tests\Unit\Carousels;
use App\Shop\Carousels\Carousel;
use App\Shop\Carousels\Repositories\CarouselRepository;
use Tests\TestCase;
class CarouselUnitTest extends TestCase
{
/** @test */
public function it_can_create_a_carousel()
{
$data = [
'title' => $this->faker->word,
'link' => $this->faker->url,
'src' => $this->faker->url,
];
$carouselRepo = new CarouselRepository(new Carousel);
$carousel = $carouselRepo->createCarousel($data);
$this->assertInstanceOf(Carousel::class, $carousel);
$this->assertEquals($data['title'], $carousel->title);
$this->assertEquals($data['link'], $carousel->link);
$this->assertEquals($data['image_src'], $carousel->src);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment