dependencyMock = Mockery::mock('DependencyInterface'); $this->service = new {{ClassName}}($this->dependencyMock); }); describe('{{ClassName}}', function () { it('executes successfully with valid input', function () { // Arrange $input = 'sample_input'; $expectedResult = 'success_result'; $this->dependencyMock ->shouldReceive('execute') ->once() ->with($input) ->andReturn($expectedResult); // Act $result = $this->service->process($input); // Assert expect($result)->toBe($expectedResult); }); it('handles edge case input properly', function () { // Arrange $this->dependencyMock ->shouldReceive('execute') ->once() ->with('') ->andReturn('default_output'); // Act & Assert expect($this->service->process(''))->toBe('default_output'); }); it('throws exception when dependency throws error', function () { $this->dependencyMock ->shouldReceive('execute') ->once() ->andThrow(new \RuntimeException('Execution failed')); expect(fn () => $this->service->process('error_trigger')) ->toThrow(\RuntimeException::class, 'Execution failed'); }); });