1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [Stub](<https://delaparra-services.nl/knowledge-hub/stub>)

  

Category: Core glossary 

# Stub

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is Stub?

 

Stub: A simplified replacement for a dependency in testing — it returns hardcoded responses without executing real logic. Similar to a mock, but stubs typically focus on providing canned answers rather than verifying calls. A stub is a simple stand-in for a real dependency in a test. It returns fixed answers without doing real work, so the code under test can run in isolation.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about Stub

  

### How is Stub used in practice?

 

A stub for a payment gateway might always return "approved", so you can test what your checkout does after a successful payment without calling a real payment provider or spending money.

    

### What should you keep in mind with Stub?

 

The difference from a mock is focus. A stub provides answers; a mock also checks how it was called, such as whether ` charge() ` was called exactly once with the right amount. Laravel offers fakes like ` Mail::fake() ` and ` Http::fake() ` that combine both. Use stubs for external services and slow dependencies, and keep tests that exercise real database logic against a real test database.

 

## At a glance

   CategoryCore glossary Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Core glossary terms

 

- [State](<https://delaparra-services.nl/knowledge-hub/state>) 
- [Stateless](<https://delaparra-services.nl/knowledge-hub/stateless>) 
- [Static](<https://delaparra-services.nl/knowledge-hub/static>) 
- [Technical debt](<https://delaparra-services.nl/knowledge-hub/technical-debt>) 
- [Throughput](<https://delaparra-services.nl/knowledge-hub/throughput>) 
- [Token](<https://delaparra-services.nl/knowledge-hub/token>)

 

[All terms starting with S](<https://delaparra-services.nl/knowledge-hub#letter-s>)

 

## Skills

 

- ### Test-Driven Development (TDD)

 

Use when implementing any feature or bugfix, before writing implementation code

 [View skill](<https://delaparra-services.nl/skills/test-driven-development>) [Download zip](<https://delaparra-services.nl/skills/test-driven-development/download>) 
- ### E2E Testing Patterns

 

Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment. Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.

 [View skill](<https://delaparra-services.nl/skills/e2e-testing-patterns>) [Download zip](<https://delaparra-services.nl/skills/e2e-testing-patterns/download>) 
- ### Web Application Testing

 

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

 [View skill](<https://delaparra-services.nl/skills/webapp-testing>) [Download zip](<https://delaparra-services.nl/skills/webapp-testing/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/stub/skills.zip>)

 

## Manuals

 

- [Testing your app with Pest](<https://delaparra-services.nl/manuals/je-app-testen-met-pest>)

 

## Related services

 

- [AI code review](<https://delaparra-services.nl/services#service-05>)

When you push your new change, I will review your code, help your agent avoid the same mistake again, and get your app ready for deployment. 
- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/stub)
