{"id":15022854,"url":"https://github.com/stratedge/wye","last_synced_at":"2026-01-21T10:36:59.109Z","repository":{"id":57060345,"uuid":"66737228","full_name":"stratedge/wye","owner":"stratedge","description":"A library that makes unit testing database-driven code in PHP a breeze. Mock the native PDO class, define query results, and inspect executed statements.","archived":false,"fork":false,"pushed_at":"2018-02-04T04:21:07.000Z","size":187,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T20:16:20.782Z","etag":null,"topics":["mocking","mysql","pdo","pdo-replacement","php","phpunit","unit-test","unit-testing","unit-tests"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/stratedge.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-27T21:55:24.000Z","updated_at":"2017-05-20T05:53:46.000Z","dependencies_parsed_at":"2022-08-24T14:53:31.075Z","dependency_job_id":null,"html_url":"https://github.com/stratedge/wye","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/stratedge/wye","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratedge%2Fwye","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratedge%2Fwye/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratedge%2Fwye/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratedge%2Fwye/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stratedge","download_url":"https://codeload.github.com/stratedge/wye/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratedge%2Fwye/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mocking","mysql","pdo","pdo-replacement","php","phpunit","unit-test","unit-testing","unit-tests"],"created_at":"2024-09-24T19:58:27.441Z","updated_at":"2026-01-21T10:36:59.093Z","avatar_url":"https://github.com/stratedge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wye\n\n[![Build Status](https://travis-ci.org/stratedge/wye.svg?branch=master)](https://travis-ci.org/stratedge/wye)\n[![Latest Stable Version](https://poser.pugx.org/stratedge/wye/v/stable)](https://packagist.org/packages/stratedge/wye)\n[![Total Downloads](https://poser.pugx.org/stratedge/wye/downloads)](https://packagist.org/packages/stratedge/wye)\n[![License](https://poser.pugx.org/stratedge/wye/license)](https://packagist.org/packages/stratedge/wye)\n\nA library that makes unit testing database-driven code in PHP a breeze. Mock the native PDO class, define query results, and inspect executed statements.\n\n\"[In firefighting a] hose appliance used for splitting one line into two discharges. Often a gated wye is used to allow and disallow water flow through the two separate discharges.\" - [https://en.wikipedia.org/wiki/Glossary\\_of\\_firefighting\\_equipment#Wye](https://en.wikipedia.org/wiki/Glossary\\_of\\_firefighting\\_equipment#Wye)\n\n# Installation\n\nWye is registered with [Packagist](https://packagist.org) and can be installed with [Composer](https://getcomposer.org). Run the following on the command line:\n\n```sh\ncomposer require --dev stratedge/wye\n```\n\nOnce Wye has been included in your project, just make sure to require Composer's autoloader:\n\n```php\nrequire_once 'vendor/autoload.php';\n```\n\n# Basic Usage Example\n\n```php\nuse Stratedge\\Wye\\Wye;\n\n//In test setup\n//-------------\n\n//Reset the Wye to its clean state\nWye::reset()\n\n//Create a Wye PDO object\n$pdo = Wye::makePDO();\n\n//Inject PDO into database layer\nDatabase::setConnection($pdo);\n\n//In test\n//-------\n\n//Create a Result object\n$result = Wye::makeResult();\n\n//Add a row or two to return\n$result-\u003eaddRow(['type' =\u003e 'Pumper', 'apparatus' =\u003e 'Engine 1']);\n\n//Attach Result to Wye to be served when a query is executed\n$result-\u003eattach();\n\n//Run code to test\n$class_to_test-\u003edoSomething();\n\n//Inspect execution\n$stmt = Wye::getStatementAtIndex(0);\n$this-\u003eassertStringStartsWith('SELECT', $stmt-\u003egetStatement());\n$this-\u003eassertCount(2, count($stmt-\u003egetBindings());\n$this-\u003eassertSame('id', $stmt-\u003egetBindings()-\u003efirst()-\u003egetParameter());\n$this-\u003eassertSame(1, Wye::getNumQueries());\n//and more!\n```\n\n\u003e **\u003cu\u003eWAIT, THERE'S MORE\u003c/u\u003e**  \n\u003e For a much more in-depth look at Wye's usage, check out the extensive documentation, especially the section on [Basic Usage](https://github.com/stratedge/wye/wiki/Introduction#basic-usage).\n\n# Documentation\n\nComplete and up-to-date documentation is available on [the Wiki](https://github.com/stratedge/wye/wiki).\n\nSome of the major topics discussed include: [An Introduction](https://github.com/stratedge/wye/wiki/Introduction), [Defining Results](https://github.com/stratedge/wye/wiki/Defining-Results), [Inspecting Execution Info](https://github.com/stratedge/wye/wiki/Inspecting-Execution-Info), and [Inspecting Bindings](https://github.com/stratedge/wye/wiki/Inspecting-Bindings).\n\n## Todo \u0026 Roadmap\n\nList of enhancements and implementations is available on the [Todo \u0026 Roadmap](https://github.com/stratedge/wye/wiki/Todo-\u0026-Roadmap) page of the wiki.\n\n## Issue Tracking\n\nIf you should find an issue in Wye, and you think you can fix it, by all means please do so. Pull requests are gladly accepted. If you don't have the time or energy to fix it, please log the issue with as much detail as possible so I can take a look.\n\nIssues can be logged on the [Github issue tracker](https://github.com/stratedge/wye/issues).\n\n## Acknowledgements\n\nWye is built on top of an idea I first saw implemented by my friend/colleague [Josh](https://github.com/phpcodecrafting).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratedge%2Fwye","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstratedge%2Fwye","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratedge%2Fwye/lists"}