{"id":22476877,"url":"https://github.com/degraciamathieu/interface-testing","last_synced_at":"2026-02-02T14:31:52.221Z","repository":{"id":266618639,"uuid":"822755992","full_name":"DeGraciaMathieu/interface-testing","owner":"DeGraciaMathieu","description":"How to test an interface with phpunit ","archived":false,"fork":false,"pushed_at":"2024-07-01T19:55:20.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T21:52:45.245Z","etag":null,"topics":["phpunit","test","testing"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeGraciaMathieu.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-01T18:53:48.000Z","updated_at":"2024-07-12T16:43:48.000Z","dependencies_parsed_at":"2024-12-05T08:12:28.840Z","dependency_job_id":"0486d576-5b55-4e30-b7c0-75506b1d189f","html_url":"https://github.com/DeGraciaMathieu/interface-testing","commit_stats":null,"previous_names":["degraciamathieu/interface-testing"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DeGraciaMathieu/interface-testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Finterface-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Finterface-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Finterface-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Finterface-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeGraciaMathieu","download_url":"https://codeload.github.com/DeGraciaMathieu/interface-testing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeGraciaMathieu%2Finterface-testing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260718586,"owners_count":23051914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["phpunit","test","testing"],"created_at":"2024-12-06T14:08:04.879Z","updated_at":"2026-02-02T14:31:52.191Z","avatar_url":"https://github.com/DeGraciaMathieu.png","language":"PHP","readme":"## How to test an interface\n\nIt is difficult to test an interface directly because it contains signatures and not behaviors.\n\nWe could create as many test classes as there are implementations of an interface, but this would be time-consuming and potentially bug-inducing.\n\nAn effective solution is to separate the business logic of an interface from the implementation details.\n\n![image](https://github.com/DeGraciaMathieu/interface-testing/assets/11473997/8b4fd508-9047-4dc6-a11c-a16991a5f382)\n\n- `AbstractUserRepository` contains the test methods and various assertions, e.g. : \"it_able_to_find_user_by_id\"; they do not contain any implementation-specific logic. \n- `UserRepositoryInMemoryTest` and `UserRepositoryInSessionTest` contain only the instantiation logic of the implementations; they do not contain any test logic.\n\nThis separation enhances the reliability and relevance of the tests and allows behaviors to be assigned to interfaces.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegraciamathieu%2Finterface-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegraciamathieu%2Finterface-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegraciamathieu%2Finterface-testing/lists"}