Skip to content

Instantly share code, notes, and snippets.

@jsdecena
Last active March 5, 2019 08:30
Show Gist options
  • Save jsdecena/c73184fd5fd1457cf4951921f8559cd1 to your computer and use it in GitHub Desktop.
Save jsdecena/c73184fd5fd1457cf4951921f8559cd1 to your computer and use it in GitHub Desktop.
Carousel Unit Test File
<?php
namespace Tests\Unit\Carousels;
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);
}
}
@ACvijic
Copy link

ACvijic commented Mar 5, 2019

image_src should be just src in your last assertion in it_can_create_a_carousel()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment