{"id":23359771,"url":"https://github.com/firehed/mocktrine","last_synced_at":"2025-04-10T10:32:04.663Z","repository":{"id":48117770,"uuid":"43853263","full_name":"Firehed/mocktrine","owner":"Firehed","description":"Mock Doctrine more easily","archived":false,"fork":false,"pushed_at":"2024-11-15T02:59:09.000Z","size":123,"stargazers_count":5,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T08:50:10.309Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Firehed.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}},"created_at":"2015-10-08T00:46:22.000Z","updated_at":"2024-09-23T16:47:44.000Z","dependencies_parsed_at":"2024-01-30T04:43:48.151Z","dependency_job_id":null,"html_url":"https://github.com/Firehed/mocktrine","commit_stats":{"total_commits":30,"total_committers":3,"mean_commits":10.0,"dds":0.3666666666666667,"last_synced_commit":"87128b7728f1cbe557d1ac307e09692d20a691d8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firehed%2Fmocktrine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firehed%2Fmocktrine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firehed%2Fmocktrine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Firehed%2Fmocktrine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Firehed","download_url":"https://codeload.github.com/Firehed/mocktrine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199136,"owners_count":21063641,"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":[],"created_at":"2024-12-21T11:11:55.451Z","updated_at":"2025-04-10T10:32:04.644Z","avatar_url":"https://github.com/Firehed.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mocktrine\n\nA Doctrine mocking library for testing\n\n[![Latest Stable Version](https://poser.pugx.org/firehed/mocktrine/v)](//packagist.org/packages/firehed/mocktrine)\n[![License](https://poser.pugx.org/firehed/mocktrine/license)](//packagist.org/packages/firehed/mocktrine)\n[![Test](https://github.com/Firehed/mocktrine/workflows/Test/badge.svg)](https://github.com/Firehed/mocktrine/actions?query=workflow%3ATest)\n[![Static analysis](https://github.com/Firehed/mocktrine/workflows/Static%20analysis/badge.svg)](https://github.com/Firehed/mocktrine/actions?query=workflow%3A%22Static+analysis%22)\n[![Lint](https://github.com/Firehed/mocktrine/workflows/Lint/badge.svg)](https://github.com/Firehed/mocktrine/actions?query=workflow%3ALint)\n\n## Usage\n\nIn your unit tests that need an Entity Manager, use a `new \\Firehed\\Mocktrine\\InMemoryEntityManager`. Done!\n\nAny object with Doctrine's entity annotations (`@Entity`, `@Id`, `@Column`, etc) should work without modification.\n\nThis library aims to provide as much type information as possible, so that static analysis tools (such as PHPStan) work well without additional plugins.\n\n### Mapping support\n\nAs of version 0.5, any mapping driver supported by Doctrine can be used with this library.\nThe `InMemoryEntityManager` accepts the driver as an optional parameter.\n\n```diff\n- $em = new Mocktrine\\InMemoryEntityManager();\n+ $em = new Mocktrine\\InMemoryEntityManager(\n+     \\Doctrine\\ORM\\Mapping\\Driver\\AttributeDriver(['src/Model']),\n+ );\n```\n\nYou can also grab the value directly from your Doctrine config:\n```php\n$config = Setup::createAnnotationMetadataDriverConfiguration(...)\n$driver = $config-\u003egetMetadataDriverImpl();\n$em = new Mocktrine\\InMemoryEntityManager($driver)\n```\n\nIf a driver is not provided, it will default to either `SimpleAnnotationReader` or `AnnotationReader` that's used via `Setup::createAnnotationMetadataConfiguration`.\nThe former will be preferred, but the class has been removed in `doctrine/annotations:2.0`; if your local dependencies allow that version then the latter will be used.\n\nIt is RECOMMENDED to always explicitly provide a driver, as that best matches Doctrine's own setup behavior.\nFuture versions of this library may make this required.\n\n## Supported features\n\nThe following methods on Doctrine's `EntityManagerInterface` should all work as expected:\n- find\n- persist\n- remove\n- merge\n- flush\n- getRepository\n- getCache (will always return `null`)\n- isOpen (will always return `true`)\n\nAll methods on the `ObjectRepository` (for various findBy operations) should also work, as well as the non-interface `count($criteria)` method.\n`ObjectRepository` also implements the `Selectable` interface (as `EntityRepository` does, which is the returned type from `EntityManager`), so it's also possible to use the `matching(Criteria)` method.\n\nThe following methods are **not** supported at this time:\n- clear\n- detach\n- refresh\n- getClassMetadata\n- getMetadataFactory\n- initializeObject\n- contains\n- getConnection\n- getExpressionBuilder\n- beginTransaction\n- transactional\n- commit\n- rollback\n- createQuery\n- createNamedQuery\n- createNativeQuery\n- createNamedNativeQuery\n- getReference\n- getPartialReference\n- close\n- copy\n- lock\n- getEventManager\n- getConfiguration\n- getUnitOfWork\n- getHydrator\n- newHydrator\n- getProxyFactory\n- getFilters\n- isFiltersStateClean\n- hasFilters\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirehed%2Fmocktrine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirehed%2Fmocktrine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirehed%2Fmocktrine/lists"}