File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
stubs/modules/Blog/Tests/Site Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 8
8
uses (TestCase::class, RefreshDatabase::class);
9
9
10
10
beforeEach (function () {
11
- $ this ->post = Post::factory ()->create ();
11
+ $ this ->post = Post::factory ()->create ([
12
+ 'title ' => 'Test Post ' ,
13
+ 'content ' => 'Test Content ' ,
14
+ 'published_at ' => now ()->subDay (),
15
+ ]);
12
16
});
13
17
14
18
afterEach (function () {
15
19
if ($ this ->post ->image ) {
16
- Storage::disk ('public ' )->delete ('blog/ ' . $ this ->post ->image );
20
+ Storage::disk ('public ' )->delete ('blog/ ' . $ this ->post ->image );
17
21
}
18
22
});
19
23
20
24
test ('blog index page can be rendered ' , function () {
25
+ $ this ->withoutVite ();
21
26
$ response = $ this ->get ('/blog ' );
22
27
23
28
$ response ->assertStatus (200 );
29
+ $ response ->assertSee ('Blog ' );
30
+ $ response ->assertSee ($ this ->post ->title );
31
+ });
32
+
33
+ test ('blog post page can be rendered ' , function () {
34
+ $ this ->withoutVite ();
35
+ $ response = $ this ->get ('/blog/ ' . $ this ->post ->slug );
36
+
37
+ $ response ->assertStatus (200 );
38
+ $ response ->assertSee ($ this ->post ->title );
39
+ $ response ->assertSee ($ this ->post ->content );
24
40
});
You can’t perform that action at this time.
0 commit comments