Generated test controller not using route naming based on config `plural_routes`
RamdanK opened this issue · 1 comments
RamdanK commented
- Laravel Version: 10.0
- PHP Version: 8.1.16
- Blueprint Version: 2.7
- Platform: Mac
Issue:
When I set config plural_routes
on config/blueprint.php
into true, the generated test controller does not using this rule that make the test failed.
draft.yaml:
models:
Tag:
name: string
relationships:
belongsToMany: Post
Post:
title: string
slug: string unique
content: longtext
published_at: nullable timestamp
relationships:
hasMany: Comment
belongsTo: User
belongsToMany: Tag
PostTag:
post_id: id foreign:posts primary
tag_id: id foreign:tags primary
Comment:
content: longtext
user_id: id foreign:users
controllers:
Tag:
resource: api
Post:
resource: api
Comment:
resource: api
seeders: Tag, Post, Comment
blueprint.php
[
...other config,
/*
|--------------------------------------------------------------------------
| Pluralize route names
|--------------------------------------------------------------------------
|
| By default, Blueprint will use the `kebab-case` of the controller name
| for the route name. If you would like to ensure a plural route name
| is used, you may set this to `true`.
|
*/
'plural_routes' => true
Generated Post Controller
it('index behaves as expected', function () {
$posts = Post::factory()->times(3)->create();
$response = $this->get(route('post.index')); ==> this route does not using plural name based on config
$response->assertOK();
$response->assertJsonStructure([]);
});
This is my first time to create an issue. I'm sorry if this issue is duplicate or not clearly explained. Thanks.
jasonmccreary commented
Thanks for reporting. Feel free to open a PR with a potential fix. Otherwise, I'll try to get to it later this month.