Skip to content

Instantly share code, notes, and snippets.

@aungwinthant
Created September 16, 2019 04:05
Show Gist options
  • Save aungwinthant/18d3874a1733dc80548baf71d57c9096 to your computer and use it in GitHub Desktop.
Save aungwinthant/18d3874a1733dc80548baf71d57c9096 to your computer and use it in GitHub Desktop.
Feature Testing Category
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class CategoryTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function test_it_can_save_a_new_category()
{
$data = [
"name" => "Test Category"
];
$response = $this->post('/categories',$data);
$this->assertDatabaseHas('categories',$data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment