Skip to content

Instantly share code, notes, and snippets.

@jsdecena
Created March 14, 2018 01:40
Show Gist options
  • Save jsdecena/2588cb2e5f9b0ad3c01a932137db68bf to your computer and use it in GitHub Desktop.
Save jsdecena/2588cb2e5f9b0ad3c01a932137db68bf to your computer and use it in GitHub Desktop.
<?php
namespace Tests\Feature;
use Tests\TestCase;
class ArticleTest extends TestCase
{
/** @test */
public function it_can_create_an_article()
{
$title = $this->faker->word;
$data = [
'title' => $title,
'slug' => str_slug($title),
'excerpt' => $this->faker->sentence,
'content' => $this->faker->paragraph,
'author_id' => 1,
'status_id' => 1,
'date_start' => null,
'date_end' => null
];
$this->post("api/v1/articles", $data)
->assertStatus(201)
->assertJsonStructure(array_keys($data), $data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment