{"id":15022829,"url":"https://github.com/jclaveau/phpunit-profile-asserts","last_synced_at":"2026-03-09T01:33:59.922Z","repository":{"id":56997473,"uuid":"140821314","full_name":"jclaveau/phpunit-profile-asserts","owner":"jclaveau","description":"Provides asserts against memory usage and execution time for PHPUnit","archived":false,"fork":false,"pushed_at":"2026-03-04T19:26:44.000Z","size":20,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-04T23:52:53.140Z","etag":null,"topics":[],"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/jclaveau.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}},"created_at":"2018-07-13T08:41:34.000Z","updated_at":"2026-03-04T19:26:50.000Z","dependencies_parsed_at":"2022-08-21T14:50:13.164Z","dependency_job_id":null,"html_url":"https://github.com/jclaveau/phpunit-profile-asserts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jclaveau/phpunit-profile-asserts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclaveau%2Fphpunit-profile-asserts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclaveau%2Fphpunit-profile-asserts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclaveau%2Fphpunit-profile-asserts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclaveau%2Fphpunit-profile-asserts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jclaveau","download_url":"https://codeload.github.com/jclaveau/phpunit-profile-asserts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jclaveau%2Fphpunit-profile-asserts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30279777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2024-09-24T19:58:25.728Z","updated_at":"2026-03-09T01:33:59.879Z","avatar_url":"https://github.com/jclaveau.png","language":"PHP","readme":"# phpunit-profile-asserts\n\nThis lib provides asserts against execution time and memory usage.\nIt also provides a StopwatchListener based on the Stopwatch component of Symfony.\n\n[![Build Status](https://travis-ci.org/jclaveau/phpunit-profile-asserts.svg?branch=master)](https://travis-ci.org/jclaveau/phpunit-profile-asserts)\n\n## Installation\n\n\nphpunit-profile-asserts is installable via [Composer](http://getcomposer.org)\nand should be added as a `require-dev` dependency:\n\n    composer require --dev jclaveau/phpunit-profile-asserts\n\n## Usage\n\nEnable by adding the following code to your project's `phpunit.xml` file:\n\n```xml\n\u003cphpunit bootstrap=\"vendor/autoload.php\"\u003e\n...\n    \u003clisteners\u003e\n        \u003clistener class=\"JClaveau\\PHPUnit\\Listener\\StopwatchListener\" /\u003e\n    \u003c/listeners\u003e\n\u003c/phpunit\u003e\n```\n\n```php\nclass SomeTestCase extends \\PHPUnit_Framework_TestCase\n{\n    use \\JClaveau\\PHPUnit\\Framework\\UsageConstraintTrait; // adds the asserts methods\n\n    /**\n     */\n    public function test_usages()\n    {\n        // ...\n\n        $this-\u003eassertExecutionTimeBelow(1.5); // seconds\n        $this-\u003eassertMemoryUsageBelow('1M');\n\n        // This trait also provides two methods to help knowing the current\n        // memory usage and duration\n        $this-\u003egetMemoryUsage();\n        $this-\u003egetExecutionTime();\n    }\n\n}\n```\n\n## TODO\n\n+ PHP 7 implementation (find an elegant way to support PHP 5 and 7 together)\n+ Integrate SpeedTrap and adds MemoryTrap\n+ Investigate xhprof integration and asserts on number of calls / execution time of specific methods/functions\n\n## Inspiration\n\n+ https://github.com/usernam3/phpunit_stopwatch_annotations\n+ https://github.com/johnkary/phpunit-speedtrap\n\n\n## License\n\nphpunit-profile-asserts is available under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjclaveau%2Fphpunit-profile-asserts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjclaveau%2Fphpunit-profile-asserts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjclaveau%2Fphpunit-profile-asserts/lists"}