Skip to content

Commit 1c292bd

Browse files
authored
wip
1 parent 964a39d commit 1c292bd

3 files changed

Lines changed: 1 addition & 20 deletions

File tree

app/Models/Post.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use App\Models\Concerns\Threadable;
88
use App\Models\Concerns\Tweetable;
99
use Illuminate\Database\Eloquent\Builder;
10-
use Illuminate\Database\Eloquent\Casts\Attribute;
1110
use Illuminate\Database\Eloquent\Collection;
1211
use Illuminate\Database\Eloquent\Factories\HasFactory;
1312
use Illuminate\Database\Eloquent\Model;

database/factories/PostFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function definition(): array
1616
return [
1717
'title' => $this->faker->sentence(),
1818
'slug' => $this->faker->slug(),
19+
'excerpt' => $this->faker->sentences(asText: true),
1920
'text' => $this->faker->paragraphs(asText: true),
2021
'is_published' => false,
2122
'published_at' => null,

tests/Feature/Models/PostTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,6 @@
7878
});
7979
});
8080

81-
describe('excerpt', function () {
82-
it('returns limited first line of text', function () {
83-
$post = Post::factory()->create([
84-
'text' => 'This is the first line'.PHP_EOL.'This is the second line',
85-
]);
86-
87-
expect($post->excerpt)->toBe('This is the first line');
88-
});
89-
90-
it('returns limited text when there is no newline', function () {
91-
$longText = str_repeat('a', 300);
92-
$post = Post::factory()->create([
93-
'text' => $longText,
94-
]);
95-
96-
expect(mb_strlen($post->excerpt))->toBe(103);
97-
});
98-
});
99-
10081
describe('scopes', function () {
10182
it('only returns published posts with wherePublished scope', function () {
10283
$published = Post::factory()->published()->create();

0 commit comments

Comments
 (0)