-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): add MarkdownWithDateModelTest and change test dummy conte…
…nt directory structure
- Loading branch information
1 parent
816faf7
commit 5f92bd7
Showing
11 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Carbon\Carbon; | ||
use Illuminate\Support\Facades\Config; | ||
use TheBatClaudio\EloquentMarkdown\Models\MarkdownWithDateModel; | ||
|
||
class TestWithDateModel extends MarkdownWithDateModel | ||
{ | ||
} | ||
|
||
beforeEach(function () { | ||
Config::set('markdown-model.path', __DIR__.'/../content/blog'); | ||
}); | ||
|
||
it('returns all files calling all method', function () { | ||
$markdowns = TestWithDateModel::all()->toArray(); | ||
|
||
expect($markdowns) | ||
->not->toBeEmpty() | ||
->toHaveCount(3) | ||
->and(array_keys($markdowns)) | ||
->toContain( | ||
'2024-05-26-yet-another-test', | ||
'2024-05-24-another-test', | ||
'2024-05-22-test', | ||
); | ||
}); | ||
|
||
it('should have date attribute', function () { | ||
$markdown = TestWithDateModel::find('2024-05-26-yet-another-test'); | ||
|
||
expect($markdown) | ||
->not->toBeNull() | ||
->and($markdown->toArray()) | ||
->toHaveKey('date') | ||
->and($markdown->date) | ||
->toBeInstanceOf(Carbon::class) | ||
->and( | ||
(new Carbon('2024-05-26')) | ||
->equalTo($markdown->date) | ||
) | ||
->toBeTrue(); | ||
}); | ||
|
||
it('should have slug attribute', function () { | ||
$markdown = TestWithDateModel::find('2024-05-26-yet-another-test'); | ||
|
||
expect($markdown) | ||
->not->toBeNull() | ||
->and($markdown->toArray()) | ||
->toHaveKey('slug') | ||
->and($markdown->slug) | ||
->toBe('yet-another-test'); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
first_attribute: First attribute | ||
second_attribute: Second attribute | ||
third_attribute: Third attribute | ||
--- | ||
The time has come. You know it. In your mind. In your heart. In your soul. You tried to hold me back. But you can't, | ||
Bruce. You're weak. You're a shell. A rusty trap that cannot hold me. Let it go. Let me OUT. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
first_attribute: First attribute | ||
second_attribute: Second attribute | ||
third_attribute: Third attribute | ||
--- | ||
The time has come. You know it. In your mind. In your heart. In your soul. You tried to hold me back. But you can't, | ||
Bruce. You're weak. You're a shell. A rusty trap that cannot hold me. Let it go. Let me OUT. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
first_attribute: First attribute | ||
second_attribute: Second attribute | ||
third_attribute: Third attribute | ||
--- | ||
The time has come. You know it. In your mind. In your heart. In your soul. You tried to hold me back. But you can't, | ||
Bruce. You're weak. You're a shell. A rusty trap that cannot hold me. Let it go. Let me OUT. |
Empty file.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
first_attribute: First attribute | ||
second_attribute: Second attribute | ||
third_attribute: Third attribute | ||
--- | ||
The time has come. You know it. In your mind. In your heart. In your soul. You tried to hold me back. But you can't, | ||
Bruce. You're weak. You're a shell. A rusty trap that cannot hold me. Let it go. Let me OUT. |
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
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