Skip to content

Commit c6272a3

Browse files
committed
ITT: New publish_date field renamed to publish_at and tests added.
1 parent c8e97b3 commit c6272a3

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

tests/TestingTools/Asserts/EloquentAssertsTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function it_has_eloquent_table_not_equals_assertion()
2323
/** @test */
2424
public function it_has_eloquent_fillable_equals_assertion()
2525
{
26-
$this->assertEloquentFillableEquals(Post::class, ['title']);
26+
$this->assertEloquentFillableEquals(Post::class, ['title', 'publish_at']);
2727
}
2828

2929
/** @test */
@@ -32,6 +32,12 @@ public function it_has_eloquent_fillable_not_equals_assertion()
3232
$this->assertEloquentFillableNotEquals(Post::class, ['title', 'body']);
3333
}
3434

35+
/** @test */
36+
public function it_has_eloquent_dates_equals_assertion()
37+
{
38+
$this->assertEloquentDatesEquals(Post::class, ['publish_at', 'created_at', 'updated_at']);
39+
}
40+
3541
/** @test */
3642
public function it_has_eloquent_touches_equals_assertion()
3743
{

tests/TestingTools/fixture/app/Post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class Post extends Model
77
use Commentable;
88

99
protected $table = 'posts';
10-
protected $fillable = ['title', 'publish_date'];
10+
protected $fillable = ['title', 'publish_at'];
11+
protected $dates = ['publish_at'];
1112

1213
public function comments()
1314
{

tests/TestingTools/fixture/database/factories/PostFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
$factory->define(Post::class, function (Faker\Generator $faker) {
44
return [
55
'title' => $faker->sentence,
6-
'publish_date' => $faker->dateTimeThisYear,
6+
'publish_at' => $faker->dateTimeThisYear,
77
];
88
});

tests/TestingTools/fixture/database/migrations/2016_11_01_131415_create_posts_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function up()
1111
Schema::create('posts', function (Blueprint $table) {
1212
$table->increments('id');
1313
$table->string('title');
14-
$table->dateTime('publish_date');
14+
$table->dateTime('publish_at');
1515
$table->timestamps();
1616
});
1717
}

0 commit comments

Comments
 (0)