<?php
namespace App\Http\Controllers;
class MyController extends Controller
{
public function update(BBJUpdateRequest $request, MyService $myService)
{
$myService->myMethod();
}
}
<?php
class MyService
{
public function myMethod(): static
{
}
}
<?php
namespace Tests\app\Http\Controllers;
/* use ... */
/**
* @covers \App\Http\Controllers\MyController
*/
class MyControllerTest extends TestCase
{
public function testSuccessfulPath()
{
$this->mock(MyService::class, function (MockInterface $mock) {
$mock->expects('myMethod')->once();
});
}
}