{"id":15704937,"url":"https://github.com/tfrommen/unit-test-examples","last_synced_at":"2025-05-12T15:39:13.769Z","repository":{"id":82225265,"uuid":"88795376","full_name":"tfrommen/unit-test-examples","owner":"tfrommen","description":"Example code for my talks and workshops on unit testing.","archived":false,"fork":false,"pushed_at":"2022-12-19T11:59:25.000Z","size":54,"stargazers_count":6,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T09:54:01.419Z","etag":null,"topics":["example-code","javascript","php","testing","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tfrommen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-04-19T22:11:33.000Z","updated_at":"2024-01-27T20:28:28.000Z","dependencies_parsed_at":"2023-05-05T03:08:45.053Z","dependency_job_id":null,"html_url":"https://github.com/tfrommen/unit-test-examples","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"54d487a271e48b102e48b9a993d98830892ae53d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfrommen%2Funit-test-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfrommen%2Funit-test-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfrommen%2Funit-test-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfrommen%2Funit-test-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tfrommen","download_url":"https://codeload.github.com/tfrommen/unit-test-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249909186,"owners_count":21343932,"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":["example-code","javascript","php","testing","unit-testing"],"created_at":"2024-10-03T20:14:20.226Z","updated_at":"2025-04-20T14:30:34.941Z","avatar_url":"https://github.com/tfrommen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unit Test Examples\n\nExample code for my talks and workshops on unit testing.\n\n## Getting Started\n\nClone this repository, or download the ZIP file.\n\nThere is both PHP and JavaScript example code waiting for you at `src/php/` and `src/js/`, respectively.\n\n## Writing Tests\n\nThe repository is set up for you to write PHP tests with [PHPUnit](https://github.com/sebastianbergmann/phpunit), and JavaScript tests with [Jest](https://github.com/facebook/jest).\nIf you would rather use something else instead, feel free to adapt `composer.json` and `package.json`, respectively.\n\n### PHP Tests\n\nIn order to run the PHP tests, you have to install the required PHP packages first.\n\nInstall with [Composer](https://getcomposer.org/):\n\n```shell\n$ composer install\n```\n\nBy default, this will install PHPUnit as well as [Mockery](https://github.com/mockery/mockery), [Patchwork](https://github.com/antecedent/patchwork/) and [Brain Monkey](https://github.com/Brain-WP/BrainMonkey).\n\nThen, execute PHPUnit, which will use the configuration provided in `phpunit.xml.dist`:\n\n```shell\n$ ./vendor/bin/phpunit\n```\n\n### JavaScript Tests\n\nIn order to run the JavaScript tests, you have to install the required JavaScript packages first.\n\nInstall with [Yarn](https://github.com/yarnpkg/yarn):\n\n```shell\n$ yarn\n```\n\nBy default, this will install Jest (inlcuding [`jest-each`](https://github.com/mattphillips/jest-each)), [`react-test-renderer`](https://github.com/facebook/react/tree/master/packages/react-test-renderer) and [Enzyme](https://github.com/airbnb/enzyme) (including [`enzyme-adapter-react-16`](https://github.com/airbnb/enzyme/tree/master/packages/enzyme-adapter-react-16)), as well as the [`babel-preset-env`](https://github.com/babel/babel/tree/master/packages/babel-preset-env) and [`babel-preset-react`](https://github.com/babel/babel/tree/master/packages/babel-preset-react) packages.\n\nThen, run the `test` script, defined in `package.json`:\n\n```shell\n$ yarn test\n```\n\n----\n\nIn case you want to use [npm](https://github.com/npm/npm) instead, do it like so:\n\n```shell\n$ npm i \u0026\u0026 npm run test\n```\n\n## License\n\nCopyright (c) 2018 Thorsten Frommen\n\nThis code is licensed under the [MIT License](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfrommen%2Funit-test-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftfrommen%2Funit-test-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfrommen%2Funit-test-examples/lists"}