Created
March 8, 2018 01:06
-
-
Save jsdecena/4d5c5fe005ce63d027bc049c724aa7e2 to your computer and use it in GitHub Desktop.
Carousel Unit Test File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tests\Unit\Carousels; | |
use Tests\TestCase; | |
class CarouselUnitTest extends TestCase | |
{ | |
/** @test */ | |
public function it_should_throw_update_error_exception_when_the_carousel_has_failed_to_update() | |
{ | |
$this->expectException(UpdateCarouselErrorException::class); | |
$carousel = factory(Carousel::class)->create(); | |
$carouselRepo = new CarouselRepository($carousel); | |
$data = ['title' => null]; | |
$carouselRepo->updateCarousel($data); | |
} | |
/** @test */ | |
public function it_should_throw_not_found_error_exception_when_the_carousel_is_not_found() | |
{ | |
$this->expectException(CarouselNotFoundException::class); | |
$carouselRepo = new CarouselRepository(new Carousel); | |
$carouselRepo->findCarousel(999); | |
} | |
/** @test */ | |
public function it_should_throw_an_error_when_the_required_columns_are_not_filled() | |
{ | |
$this->expectException(CreateCarouselErrorException::class); | |
$carouselRepo = new CarouselRepository(new Carousel); | |
$carouselRepo->createCarousel([]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment