{
    "url": "https://delaparra-services.nl/knowledge-hub/stub",
    "locale": "en",
    "title": "Stub: Knowledge hub | DeLaParra Services",
    "description": "A simplified replacement for a dependency in testing — it returns hardcoded responses without executing real logic. Similar to a mock, but stubs typically...",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/stub",
        "nl": "https://delaparra-services.nl/nl/kennisbank/stub"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/stub.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/stub.md",
        "json": "https://delaparra-services.nl/knowledge-hub/stub.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/stub.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/stub.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub.csv",
            "encodingFormat": "text/csv",
            "name": "stub.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub.json",
            "encodingFormat": "application/json",
            "name": "stub.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub.md",
            "encodingFormat": "text/markdown",
            "name": "stub.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub.pdf",
            "encodingFormat": "application/pdf",
            "name": "stub.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub.zip",
            "encodingFormat": "application/zip",
            "name": "stub.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/stub/skills.zip",
            "encodingFormat": "application/zip",
            "name": "stub-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [Stub](<https://delaparra-services.nl/knowledge-hub/stub>)\n\n  \n\nCategory: Core glossary \n\n# Stub\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is Stub?\n\n \n\nStub: 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.\n\n \n\nDefinition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)\n\n \n\n## Frequently asked questions about Stub\n\n  \n\n### How is Stub used in practice?\n\n \n\nA 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.\n\n    \n\n### What should you keep in mind with Stub?\n\n \n\nThe 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.\n\n \n\n## At a glance\n\n   CategoryCore glossary Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026\n\n \n\n## More Core glossary terms\n\n \n\n- [State](<https://delaparra-services.nl/knowledge-hub/state>) \n- [Stateless](<https://delaparra-services.nl/knowledge-hub/stateless>) \n- [Static](<https://delaparra-services.nl/knowledge-hub/static>) \n- [Technical debt](<https://delaparra-services.nl/knowledge-hub/technical-debt>) \n- [Throughput](<https://delaparra-services.nl/knowledge-hub/throughput>) \n- [Token](<https://delaparra-services.nl/knowledge-hub/token>)\n\n \n\n[All terms starting with S](<https://delaparra-services.nl/knowledge-hub#letter-s>)\n\n \n\n## Skills\n\n \n\n- ### Test-Driven Development (TDD)\n\n \n\nUse when implementing any feature or bugfix, before writing implementation code\n\n [View skill](<https://delaparra-services.nl/skills/test-driven-development>) [Download zip](<https://delaparra-services.nl/skills/test-driven-development/download>) \n- ### E2E Testing Patterns\n\n \n\nMaster 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.\n\n [View skill](<https://delaparra-services.nl/skills/e2e-testing-patterns>) [Download zip](<https://delaparra-services.nl/skills/e2e-testing-patterns/download>) \n- ### Web Application Testing\n\n \n\nToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.\n\n [View skill](<https://delaparra-services.nl/skills/webapp-testing>) [Download zip](<https://delaparra-services.nl/skills/webapp-testing/download>)\n\n [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/stub/skills.zip>)\n\n \n\n## Manuals\n\n \n\n- [Testing your app with Pest](<https://delaparra-services.nl/manuals/je-app-testen-met-pest>)\n\n \n\n## Related services\n\n \n\n- [AI code review](<https://delaparra-services.nl/services#service-05>)\n\nWhen 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. \n- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)\n\nPerhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.\n\n \n\n## Need any help?\n\n \n\nStuck 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.\n\n  [Get in touch](<https://delaparra-services.nl/availability>)\n\n[HTML version](https://delaparra-services.nl/knowledge-hub/stub)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "FAQPage",
                "@id": "https://delaparra-services.nl/knowledge-hub/stub#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/stub",
                "name": "Stub: Knowledge hub | DeLaParra Services",
                "description": "A simplified replacement for a dependency in testing — it returns hardcoded responses without executing real logic. Similar to a mock, but stubs typically...",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/stub#term",
                    "name": "Stub",
                    "description": "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.",
                    "termCode": "stub",
                    "url": "https://delaparra-services.nl/knowledge-hub/stub",
                    "inLanguage": "en",
                    "keywords": "Core glossary",
                    "dateModified": "2026-11-25T17:46:30+00:00",
                    "inDefinedTermSet": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#terms"
                    },
                    "isPartOf": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#dataset"
                    },
                    "subjectOf": [
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/stub#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/stub#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/stub#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is Stub?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "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."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "How is Stub used in practice?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "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."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with Stub?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "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."
                        }
                    }
                ],
                "author": {
                    "@id": "https://delaparra-services.nl/#person"
                },
                "mentions": [
                    {
                        "@id": "https://delaparra-services.nl/skills/test-driven-development#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/e2e-testing-patterns#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/webapp-testing#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/je-app-testen-met-pest#article"
                    }
                ]
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/knowledge-hub/stub#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Knowledge hub",
                        "item": "https://delaparra-services.nl/knowledge-hub"
                    },
                    {
                        "@type": "ListItem",
                        "position": 3,
                        "name": "Stub"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/knowledge-hub/stub#dataset",
                "name": "Stub",
                "description": "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.",
                "url": "https://delaparra-services.nl/knowledge-hub/stub",
                "identifier": "https://delaparra-services.nl/knowledge-hub/stub#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/stub#term"
                },
                "creator": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://creativecommons.org/licenses/by/4.0/",
                "creditText": "Coders Lingo (https://coderslingo.com/resources/open-dataset/), CC BY 4.0",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "keywords": "Core glossary",
                "version": "2026-11-25",
                "dateModified": "2026-11-25T17:46:30+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#dataset",
                    "name": "IT terms from A to Z",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "stub.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "stub.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "stub.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "stub.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "stub.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "stub-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/stub/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:30+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}