@TYKUS - I kept the description as nullable so i thought it will be ignored. we your pointing was right. it was description.
about the created_at and updated_at, i just added it later on as i was not able to find what was going wrong.
not the next problem i am facing is how to validate description as null ...
$attributes = request()->validate([
'title' => 'required',
'slug' => 'required',
'banner' => 'required',
'description' => 'nullable|string',
'body' => 'nullable|text',
'author_id' => 'required',
'moderator_id' => 'required'
]);
the above made the test pass be here as the description is required, and a null / empty string is passed, i get
PHPUnit 7.5.6 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 1.06 seconds, Memory: 18.00 MB
There was 1 failure:
1) Tests\Feature\ArticleTest::a_user_can_create_a_article
Failed asserting that a row in the table [articles] matches the attributes {
"title": "Demo Article Title 1",
"slug": "demo-article-title-1",
"banner": "https:\/\/placehold.it\/600x600",
"description": "",
"body": "",
"category_id": 1,
"status": 2,
"author_id": 1,
"moderator_id": 1
}.
Found: [
{
"id": 1,
"title": "Demo Article Title 1",
"slug": "demo-article-title-1",
"banner": "https:\/\/placehold.it\/600x600",
"description": null,
"category_id": "1",
"body": null,
"views": 1,
"status": 2,
"author_id": 1,
"moderator_id": 1,
"created_at": "2019-03-05 19:19:41",
"updated_at": "2019-03-05 19:19:41"
}
].
C:\xampp\htdocs\pdpv2\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase.php:24
C:\xampp\htdocs\pdpv2\tests\Feature\ArticleTest.php:39
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
The terminal process terminated with exit code: 1