In my Laravel project I have this test:
/** @test */
public function tagControllerStore()
{
$this->post(action([TagController::class, 'store']), [
'name' => 'My tag',
'type' => 'My type',
'color' => 'white'
])
->assertOk();
}
This is my controller and the store method in it:
<?php
namespace Domain\Shared\Http\Controllers;
class TagController extends Controller
{
/**
* Store a newly created resource in storage.
*
* @return \Illuminate\Http\Response
*/
public function store(StoreTagRequest $request, Tag $tag)
{
$tag = Tag::create($request->validated());
return response()->json([
'id' => $tag->id
]);
}
}
And the result is this:
InvalidArgumentException: Action Domain\Shared\Http\Controllers\TagController@store not defined.
How can I solve this issue?