Last active
September 16, 2019 05:36
-
-
Save aungwinthant/61ecf265d05ffb5f6d97916de2c48397 to your computer and use it in GitHub Desktop.
Unit Testing Save Method
This file contains 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\Feature; | |
use App\Models\Category; | |
use App\Repositories\CategoryRepository; | |
use Tests\TestCase; | |
use Illuminate\Foundation\Testing\WithFaker; | |
use Illuminate\Foundation\Testing\RefreshDatabase; | |
class CategoryRepositoryTest extends TestCase | |
{ | |
use RefreshDatabase; | |
/** | |
* A basic feature test example. | |
* | |
* @return void | |
*/ | |
public function test_save_method_in_repository() | |
{ | |
$data = [ | |
"name" => "Test Category", | |
]; | |
$categoryRepo = new CategoryRepository(new Category); | |
$category = $categoryRepo->save($data); | |
$this->assertInstanceOf(Category::class,$category); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment