{"id":17986266,"url":"https://github.com/christophwurst/nextcloud_testing","last_synced_at":"2025-03-25T20:34:31.320Z","repository":{"id":56952561,"uuid":"121239112","full_name":"ChristophWurst/nextcloud_testing","owner":"ChristophWurst","description":"Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit","archived":false,"fork":false,"pushed_at":"2023-10-30T07:43:23.000Z","size":35,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-07T10:27:24.129Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristophWurst.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-02-12T11:35:20.000Z","updated_at":"2023-10-30T07:43:28.000Z","dependencies_parsed_at":"2022-08-21T08:20:25.408Z","dependency_job_id":null,"html_url":"https://github.com/ChristophWurst/nextcloud_testing","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophWurst%2Fnextcloud_testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophWurst%2Fnextcloud_testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophWurst%2Fnextcloud_testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristophWurst%2Fnextcloud_testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristophWurst","download_url":"https://codeload.github.com/ChristophWurst/nextcloud_testing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222091340,"owners_count":16929582,"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-10-29T18:29:11.224Z","updated_at":"2024-10-29T18:29:11.851Z","avatar_url":"https://github.com/ChristophWurst.png","language":"PHP","readme":"# Nextcloud Testing\n\nSimple and fast unit and integration testing framework for Nextcloud 25+, based on PHPUnit\n\nFeatures\n* Minimal setUp/tearDown overhead for unit tests\n* Simple trait-based mechanism to reset database after integration tests\n* Based on PHPUnit\n\n## Unit Tests\n\nUse ``TestCase`` as base class for your test case:\n\n```php\n\u003c?php\n\nuse ChristophWurst\\Nextcloud\\Testing\\TestCase;\n\nclass ControllerTest extends TestCase {\n\n    … your test code …\n\n}\n```\n\n## Integration Tests\n\nInclude the `DatabaseTransaction` trait in your test case and any changes to the database will be rolled back after each test:\n\n```php\n\u003c?php\n\nuse ChristophWurst\\Nextcloud\\Testing\\DatabaseTransaction;\nuse ChristophWurst\\Nextcloud\\Testing\\TestCase;\n\nclass ControllerTest extends TestCase {\n\n    use DatabaseTransaction;\n\n    … your test code …\n\n}\n```\n\n## Selenium Tests\n\nInclude the `Selenium` trait in your test case and access the Webdriver instance via `$this-\u003ewebDriver`:\n\n```php\n\u003c?php\n\nuse ChristophWurst\\Nextcloud\\Testing\\Selenium;\nuse ChristophWurst\\Nextcloud\\Testing\\TestCase;\n\nclass ControllerTest extends TestCase {\n\n    use Selenium;\n\n    public function testWithSelenium() {\n        …\n\n        $this-\u003ewebDriver-\u003eget('http://localhost:8080/index.php/login');\n\n        …\n    }\n\n}\n```\n\nThis framework targets [Sauce Labs](https://saucelabs.com/) as testing back-end that runs the test\nbrowser instances. Hence, it is necessary to set the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` env\nvariables. `SELENIUM_BROWSER` lets you choose the browser to run your tests against.\n\n## Test Users\n\nInclude the `TestUser` trait in your test case to conveniently generate new test users. The trait\nwill create a new user with a random UID (including collision detection).\n\n```php\n\u003c?php\n\nuse ChristophWurst\\Nextcloud\\Testing\\TestCase;\nuse ChristophWurst\\Nextcloud\\Testing\\TestUser;\n\nclass ControllerTest extends TestCase {\n\n    use TestUser;\n\n    public function testWithSelenium() {\n        …\n\n        $user = $this-\u003ecreateTestUser();\n\n        …\n    }\n\n}\n```\n\nThe returned user is of type `IUser`. You can read its UID with `$user-\u003egetUID()`. Note that the\nuser is not removed after the test.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophwurst%2Fnextcloud_testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophwurst%2Fnextcloud_testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophwurst%2Fnextcloud_testing/lists"}