{"id":15226337,"url":"https://github.com/centreon/centreon-test-lib","last_synced_at":"2025-04-09T20:30:19.008Z","repository":{"id":37458277,"uuid":"53048348","full_name":"centreon/centreon-test-lib","owner":"centreon","description":"Library for implement Behat acceptance test and PHPUnit unittest","archived":false,"fork":false,"pushed_at":"2023-12-12T13:57:27.000Z","size":1015,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":31,"default_branch":"master","last_synced_at":"2023-12-12T14:47:20.555Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/centreon.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-03T12:24:18.000Z","updated_at":"2023-12-20T15:43:29.429Z","dependencies_parsed_at":"2023-12-20T15:43:21.659Z","dependency_job_id":"469a7f77-4300-4f0c-bc9c-84e715d05007","html_url":"https://github.com/centreon/centreon-test-lib","commit_stats":{"total_commits":743,"total_committers":32,"mean_commits":23.21875,"dds":0.6864064602960969,"last_synced_commit":"ce1b847d539c62f2eefd1f7a8a0281bb4e7681cb"},"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-test-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-test-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-test-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/centreon%2Fcentreon-test-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/centreon","download_url":"https://codeload.github.com/centreon/centreon-test-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248107018,"owners_count":21048841,"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-09-28T20:04:38.912Z","updated_at":"2025-04-09T20:30:18.986Z","avatar_url":"https://github.com/centreon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Centreon Test Lib #\n\n## Rationale ##\n\nCentreon Web uses acceptance tests to ensure its software quality.\nTesting is done with the help of Behat and this project contains\nBehat-compliant classes used in many Centreon projects.\n\nWith this classes, PHP developers can mimic the interaction between\nend-users and the application. The layers are a follow and should\nexplain more clearly of classes of Centreon Test Lib heavily differs\nfrom standard Centreon classes.\n\n| Layer           | Language           | Description                                 |\n|-----------------|--------------------|---------------------------------------------|\n| Acceptance Test | PHP                | This is where acceptance tests are written and where classes from this project comes in handy. These acceptance tests are run by Behat. |\n| Behat           | PHP                | Behat run acceptance tests and provides reports. |\n| PhantomJS       | C++ but irrelevant | PhantomJS is a headless browser, optimal for testing purposes. |\n| Centreon        | PHP (web UI)       | A classical Centreon interface, with which monitoring is just plain fun. |\n\n## Class naming ##\n\nThere should be one class per Centreon page. That is, as soon as you browse to a new\npage of Centreon, a new class should be used to manipulate this page. These classes\nshould be named after the intent of the page, not after the menu from which they were\naccessed. For exemple the service creation/edition page is named\nServiceConfigurationPage. The backup configuration page in the Administration menu\nis named BackupConfigurationPage.\n\n| Menu                                                        | Class name                              |\n|-------------------------------------------------------------|-----------------------------------------|\n| Monitoring -\u003e Status Details -\u003e Services -\u003e Inspect         | ServiceMonitoringDetailsPage            |\n| Monitoring -\u003e Downtimes -\u003e Add                              | DowntimeConfigurationPage               |\n| Configuration -\u003e Hosts -\u003e Hosts -\u003e Add / Edit               | HostConfigurationPage                   |\n| Configuration -\u003e Hosts -\u003e Templates                         | HostTemplateConfigurationListingPage    |\n| Configuration -\u003e Hosts -\u003e Templates -\u003e Add / Edit           | HostTemplateConfigurationPage           |\n| Configuration -\u003e Services -\u003e Services by host               | ServiceConfigurationListingPage         |\n| Configuration -\u003e Services -\u003e Services by host -\u003e Add / Edit | ServiceConfigurationPage                |\n| Configuration -\u003e Services -\u003e Templates                      | ServiceTemplateConfigurationListingPage |\n| Configuration -\u003e Services -\u003e Templates -\u003e Add / Edit        | ServiceTemplateConfigurationPage        |\n| Configuration -\u003e Services -\u003e Meta Services -\u003e Add / Edit    | MetaServiceConfigurationPage            |\n| Configuration -\u003e Users -\u003e Contacts / Users                  | ContactConfigurationListingPage         |\n| Configuration -\u003e Users -\u003e Contacts / Users -\u003e Add / Edit    | ContactConfigurationPage                |\n| Configuration -\u003e Commands -\u003e Checks                         | CommandConfigurationListingPage         |\n| Configuration -\u003e Commands -\u003e Checks -\u003e Add / Edit           | CommandConfigurationPage                |\n| Configuration -\u003e Commands -\u003e Notifications                  | CommandConfigurationListingPage         |\n| Configuration -\u003e Commands -\u003e Notifications -\u003e Add / Edit    | CommandConfigurationPage                |\n| Configuration -\u003e Commands -\u003e Discovery                      | CommandConfigurationListingPage         |\n| Configuration -\u003e Commands -\u003e Discovery -\u003e Add / Edit        | CommandConfigurationPage                |\n| Configuration -\u003e Commands -\u003e Miscellaneous                  | CommandConfigurationListingPage         |\n| Configuration -\u003e Commands -\u003e Miscellaneous -\u003e Add / Edit    | CommandConfigurationPage                |\n| Configuration -\u003e Pollers -\u003e Pollers                         | PollerConfigurationListingPage          |\n| Configuration -\u003e Pollers -\u003e Pollers -\u003e Add / Edit           | PollerConfigurationPage                 |\n| Configuration -\u003e Pollers -\u003e Export configuration            | PollerConfigurationExportPage           |\n| Administration -\u003e Parameters -\u003e Backup                      | BackupConfigurationPage                 |\n\n## Class methods ##\n\nAs a rule of thumb methods should be kept short and perform as few actions as\npossible. It is always possible to add helper functions that perform more heavy\nprocessing but they should be *really* helpful.\n\n### Constructor ###\n\nThe constructor of a page must let users choose whether they wish to navigate\nto the requested page or not. The rationale behind this is that the same class\nshould be used when navigating directly to a specific page or when instantiating\nthe class after the page was already loaded (link clicked in another page for\nexample).\n\nIn most simple cases, navigation will be controlled by a single boolean\nargument. For example here is the constructor of the BackupConfigurationPage.\n\n```php\npublic function __construct($context, $visit = true)\n```\n\nWhen pages are more specific (they apply to a single service for example),\nthe constructor should allow navigation to the page anyway. Here is the\nconstructor of the ServiceMonitoringDetailsPage.\n\n```php\npublic function __construct($context, $host = '', $service = '')\n```\n\nIn all cases, the constructor should check for page validity by using\nisPageValid(). It should throw if the page is not valid.\n\n### isPageValid() ###\n\nThis method should check for the validity of the current page relative to\nthe class. It should return a boolean indicating whether or not the\ncurrent page can be manipulated by this class.\n\n## Common interfaces ##\n\n### Page ###\n\n```php\ninterface Page\n{\n    public function isPageValid();\n}\n```\n\n### ConfigurationPage ###\n\n```php\ninterface ConfigurationPage extends Page\n{\n    public function getProperties();\n    public function setProperties($properties);\n    public function save();\n}\n```\n\n### ListingPage ###\n\n```php\ninterface ListingPage extends Page\n{\n    public function getEntries();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fcentreon-test-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentreon%2Fcentreon-test-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentreon%2Fcentreon-test-lib/lists"}