Skip to content

Commit f208982

Browse files
committed
Fix tests.
1 parent 4f45d74 commit f208982

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

stubs/modules/Blog/Tests/AuthorTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
afterEach(function () {
2424
if ($this->author->image) {
25-
Storage::disk('public')->delete('blog/'.$this->author->image);
25+
Storage::disk('public')->delete('blog/' . $this->author->image);
2626
}
2727
});
2828

2929
test('author list can be rendered', function () {
30-
$response = $this->loggedRequest->get('/blog-author');
30+
$response = $this->loggedRequest->get('/admin/blog-author');
3131

3232
$response->assertStatus(200);
3333

@@ -49,7 +49,7 @@
4949
});
5050

5151
test('author create page can be rendered', function () {
52-
$response = $this->loggedRequest->get('/blog-author/create');
52+
$response = $this->loggedRequest->get('/admin/blog-author/create');
5353

5454
$response->assertStatus(200);
5555

@@ -60,7 +60,7 @@
6060
});
6161

6262
test('author can be created', function () {
63-
$response = $this->loggedRequest->post('/blog-author', [
63+
$response = $this->loggedRequest->post('/admin/blog-author', [
6464
'name' => 'New Name',
6565
'bio' => 'New Bio',
6666
'email' => '[email protected]',
@@ -70,13 +70,13 @@
7070

7171
$authors = Author::all();
7272

73-
$response->assertRedirect('/blog-author');
73+
$response->assertRedirect('/admin/blog-author');
7474
$this->assertCount(2, $authors);
7575
$this->assertEquals('New Name', $authors->last()->name);
7676
});
7777

7878
test('author edit page can be rendered', function () {
79-
$response = $this->loggedRequest->get('/blog-author/'.$this->author->id.'/edit');
79+
$response = $this->loggedRequest->get('/admin/blog-author/' . $this->author->id . '/edit');
8080

8181
$response->assertStatus(200);
8282

@@ -99,14 +99,14 @@
9999
});
100100

101101
test('author can be updated', function () {
102-
$response = $this->loggedRequest->put('/blog-author/'.$this->author->id, [
102+
$response = $this->loggedRequest->put('/admin/blog-author/' . $this->author->id, [
103103
'name' => 'New Name',
104104
'email' => '[email protected]',
105105
]);
106106

107-
$response->assertRedirect('/blog-author');
107+
$response->assertRedirect('/admin/blog-author');
108108

109-
$redirectResponse = $this->loggedRequest->get('/blog-author');
109+
$redirectResponse = $this->loggedRequest->get('/admin/blog-author');
110110
$redirectResponse->assertInertia(
111111
fn (Assert $page) => $page
112112
->component('BlogAuthor/AuthorIndex')
@@ -125,9 +125,9 @@
125125
});
126126

127127
test('author can be deleted', function () {
128-
$response = $this->loggedRequest->delete('/blog-author/'.$this->user->id);
128+
$response = $this->loggedRequest->delete('/admin/blog-author/' . $this->user->id);
129129

130-
$response->assertRedirect('/blog-author');
130+
$response->assertRedirect('/admin/blog-author');
131131

132132
$this->assertCount(0, Author::all());
133133
});

stubs/modules/Blog/Tests/CategoryTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
afterEach(function () {
2525
if ($this->category->image) {
26-
Storage::disk('public')->delete('blog/'.$this->category->image);
26+
Storage::disk('public')->delete('blog/' . $this->category->image);
2727
}
2828
});
2929

3030
test('category list can be rendered', function () {
31-
$response = $this->loggedRequest->get('/blog-category');
31+
$response = $this->loggedRequest->get('/admin/blog-category');
3232

3333
$response->assertStatus(200);
3434

@@ -48,7 +48,7 @@
4848
});
4949

5050
test('category create page can be rendered', function () {
51-
$response = $this->loggedRequest->get('/blog-category/create');
51+
$response = $this->loggedRequest->get('/admin/blog-category/create');
5252

5353
$response->assertStatus(200);
5454

@@ -59,7 +59,7 @@
5959
});
6060

6161
test('category can be created', function () {
62-
$response = $this->loggedRequest->post('/blog-category', [
62+
$response = $this->loggedRequest->post('/admin/blog-category', [
6363
'name' => 'Name',
6464
'description' => 'Description',
6565
'is_visible' => true,
@@ -69,13 +69,13 @@
6969

7070
$categories = Category::all();
7171

72-
$response->assertRedirect('/blog-category');
72+
$response->assertRedirect('/admin/blog-category');
7373
$this->assertCount(2, $categories);
7474
$this->assertEquals('Name', $categories->last()->name);
7575
});
7676

7777
test('category edit page can be rendered', function () {
78-
$response = $this->loggedRequest->get('/blog-category/'.$this->category->id.'/edit');
78+
$response = $this->loggedRequest->get('/admin/blog-category/' . $this->category->id . '/edit');
7979

8080
$response->assertStatus(200);
8181

@@ -99,14 +99,14 @@
9999
});
100100

101101
test('category can be updated', function () {
102-
$response = $this->loggedRequest->put('/blog-category/'.$this->category->id, [
102+
$response = $this->loggedRequest->put('/admin/blog-category/' . $this->category->id, [
103103
'name' => 'New Name',
104104
'is_visible' => true,
105105
]);
106106

107-
$response->assertRedirect('/blog-category');
107+
$response->assertRedirect('/admin/blog-category');
108108

109-
$redirectResponse = $this->loggedRequest->get('/blog-category');
109+
$redirectResponse = $this->loggedRequest->get('/admin/blog-category');
110110
$redirectResponse->assertInertia(
111111
fn (Assert $page) => $page
112112
->component('BlogCategory/CategoryIndex')
@@ -123,9 +123,9 @@
123123
});
124124

125125
test('category can be deleted', function () {
126-
$response = $this->loggedRequest->delete('/blog-category/'.$this->user->id);
126+
$response = $this->loggedRequest->delete('/admin/blog-category/' . $this->user->id);
127127

128-
$response->assertRedirect('/blog-category');
128+
$response->assertRedirect('/admin/blog-category');
129129

130130
$this->assertCount(0, Category::all());
131131
});

stubs/modules/Blog/Tests/PostTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
afterEach(function () {
2424
if ($this->post->image) {
25-
Storage::disk('public')->delete('blog/'.$this->post->image);
25+
Storage::disk('public')->delete('blog/' . $this->post->image);
2626
}
2727
});
2828

2929
test('post list can be rendered', function () {
30-
$response = $this->loggedRequest->get('/blog-post');
30+
$response = $this->loggedRequest->get('/admin/blog-post');
3131

3232
$response->assertStatus(200);
3333

@@ -47,7 +47,7 @@
4747
});
4848

4949
test('post create page can be rendered', function () {
50-
$response = $this->loggedRequest->get('/blog-post/create');
50+
$response = $this->loggedRequest->get('/admin/blog-post/create');
5151

5252
$response->assertStatus(200);
5353

@@ -58,7 +58,7 @@
5858
});
5959

6060
test('post can be created', function () {
61-
$response = $this->loggedRequest->post('/blog-post', [
61+
$response = $this->loggedRequest->post('/admin/blog-post', [
6262
'blog_author_id' => null,
6363
'blog_category_id' => null,
6464
'title' => 'Post Title',
@@ -71,13 +71,13 @@
7171

7272
$posts = Post::all();
7373

74-
$response->assertRedirect('/blog-post');
74+
$response->assertRedirect('/admin/blog-post');
7575
$this->assertCount(2, $posts);
7676
$this->assertEquals('Post Title', $posts->last()->title);
7777
});
7878

7979
test('post edit page can be rendered', function () {
80-
$response = $this->loggedRequest->get('/blog-post/'.$this->post->id.'/edit');
80+
$response = $this->loggedRequest->get('/admin/blog-post/' . $this->post->id . '/edit');
8181

8282
$response->assertStatus(200);
8383

@@ -98,13 +98,13 @@
9898
->where('meta_tag_title', $this->post->meta_tag_title)
9999
->where('meta_tag_description', $this->post->meta_tag_description)
100100
->where('tags', [])
101-
->where('published_at', $this->post->published_at->toJSON())
101+
->where('published_at', $this->post->published_at->toDateString())
102102
)
103103
);
104104
});
105105

106106
test('post can be updated', function () {
107-
$response = $this->loggedRequest->put('/blog-post/'.$this->post->id, [
107+
$response = $this->loggedRequest->put('/admin/blog-post/' . $this->post->id, [
108108
'blog_author_id' => null,
109109
'blog_category_id' => null,
110110
'title' => 'New Post Title',
@@ -114,9 +114,9 @@
114114
'published_at' => '2023-12-13',
115115
]);
116116

117-
$response->assertRedirect('/blog-post');
117+
$response->assertRedirect('/admin/blog-post');
118118

119-
$redirectResponse = $this->loggedRequest->get('/blog-post');
119+
$redirectResponse = $this->loggedRequest->get('/admin/blog-post');
120120
$redirectResponse->assertInertia(
121121
fn (Assert $page) => $page
122122
->component('BlogPost/PostIndex')
@@ -133,9 +133,9 @@
133133
});
134134

135135
test('post can be deleted', function () {
136-
$response = $this->loggedRequest->delete('/blog-post/'.$this->user->id);
136+
$response = $this->loggedRequest->delete('/admin/blog-post/' . $this->user->id);
137137

138-
$response->assertRedirect('/blog-post');
138+
$response->assertRedirect('/admin/blog-post');
139139

140140
$this->assertCount(0, Post::all());
141141
});

0 commit comments

Comments
 (0)