Skip to content

Commit 20d09f7

Browse files
committed
Add new version of common package
1 parent a69a024 commit 20d09f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3067
-1168
lines changed

.github/workflows/php.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI - PHP Build & Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- 'main'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php-version: [8.0, 8.1, 8.2, 8.3, 8.4]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php-version }}
25+
extensions: mbstring, intl
26+
tools: composer:v2
27+
28+
- name: Install dependencies
29+
run: composer install --prefer-dist --no-progress --no-suggest
30+
31+
- name: Run tests
32+
run: vendor/bin/phpunit

.gitignore

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,59 @@
1-
# dependencies
2-
vendor
1+
### JetBrains template
2+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
3+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
34

4-
# code coverage and quality reports
5+
.idea/**
6+
7+
# CMake
8+
cmake-build-*/
9+
10+
# Mongo Explorer plugin
11+
.idea/**/mongoSettings.xml
12+
13+
# File-based project format
14+
*.iws
15+
16+
# IntelliJ
17+
out/
18+
19+
# mpeltonen/sbt-idea plugin
20+
.idea_modules/
21+
22+
# JIRA plugin
23+
atlassian-ide-plugin.xml
24+
25+
# Cursive Clojure plugin
26+
.idea/replstate.xml
27+
28+
# SonarLint plugin
29+
.idea/sonarlint/
30+
31+
# Crashlytics plugin (for Android Studio and IntelliJ)
32+
com_crashlytics_export_strings.xml
33+
crashlytics.properties
34+
crashlytics-build.properties
35+
fabric.properties
36+
37+
# Editor-based Rest Client
38+
.idea/httpRequests
39+
40+
# Android studio 3.1+ serialized cache file
41+
.idea/caches/build_file_checksums.ser
42+
43+
### PHPUnit template
44+
# Covers PHPUnit
45+
# Reference: https://phpunit.de/
46+
47+
# Generated files
548
.phpunit.result.cache
6-
.phpunit.cache/
7-
/coverage/
49+
.phpunit.cache
50+
51+
# PHPUnit
52+
/app/phpunit.xml
53+
/phpunit.xml
54+
55+
# Build data
56+
/build/
57+
**/vendor/
58+
59+
.DS_Store

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Qase PHP Commons
2+
3+
This module is an SDK for developing test reporters for Qase TMS.
4+
You should use it if you're developing your own test reporter for a special-purpose framework.
5+
6+
To report results from tests using a popular framework or test runner,
7+
don't install this module directly and
8+
use the corresponding reporter module instead:
9+
10+
* [PHPUnit](https://github.com/qase-tms/qase-php/tree/main/packages/qase-phpunit#readme)
11+
12+
## Installation
13+
14+
```bash
15+
composer require --dev qase/qase-php-commons
16+
```
17+
18+
## Configuration
19+
20+
Qase PHP Reporters can be configured in multiple ways:
21+
22+
- using a config file `qase.config.json`
23+
- using environment variables
24+
25+
All configuration options are listed in the table below:
26+
27+
| Description | Config file | Environment variable | Default value | Required | Possible values |
28+
|----------------------------------------------------------------------------------------------------------------------------|----------------------------|---------------------------------|-----------------------------------------|----------|----------------------------|
29+
| **Common** | | | | | |
30+
| Mode of reporter | `mode` | `QASE_MODE` | `off` | No | `testops`, `report`, `off` |
31+
| Fallback mode of reporter | `fallback` | `QASE_FALLBACK` | `off` | No | `testops`, `report`, `off` |
32+
| Environment | `environment` | `QASE_ENVIRONMENT` | undefined | No | Any string |
33+
| Root suite | `rootSuite` | `QASE_ROOT_SUITE` | undefined | No | Any string |
34+
| Enable debug logs | `debug` | `QASE_DEBUG` | `False` | No | `True`, `False` |
35+
| **Qase Report configuration** | | | | | |
36+
| Driver used for report mode | `report.driver` | `QASE_REPORT_DRIVER` | `local` | No | `local` |
37+
| Path to save the report | `report.connection.path` | `QASE_REPORT_CONNECTION_PATH` | `./build/qase-report` | | |
38+
| Local report format | `report.connection.format` | `QASE_REPORT_CONNECTION_FORMAT` | `json` | | `json`, `jsonp` |
39+
| **Qase TestOps configuration** | | | | | |
40+
| Token for [API access](https://developers.qase.io/#authentication) | `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | undefined | Yes | Any string |
41+
| Qase API host. For enterprise users, specify full address: `api-example.qase.io` | `testops.api.host` | `QASE_TESTOPS_API_HOST` | `qase.io` | No | Any string |
42+
| Qase enterprise environment | `testops.api.enterprise` | `QASE_TESTOPS_API_ENTERPRISE` | `False` | No | `True`, `False` |
43+
| Code of your project, which you can take from the URL: `https://app.qase.io/project/DEMOTR` - `DEMOTR` is the project code | `testops.project` | `QASE_TESTOPS_PROJECT` | undefined | Yes | Any string |
44+
| Qase test run ID | `testops.run.id` | `QASE_TESTOPS_RUN_ID` | undefined | No | Any integer |
45+
| Qase test run title | `testops.run.title` | `QASE_TESTOPS_RUN_TITLE` | `Automated run <Current date and time>` | No | Any string |
46+
| Qase test run description | `testops.run.description` | `QASE_TESTOPS_RUN_DESCRIPTION` | `<Framework name> automated run` | No | Any string |
47+
| Qase test run complete | `testops.run.complete` | `QASE_TESTOPS_RUN_COMPLETE` | `True` | | `True`, `False` |
48+
| Qase test plan ID | `testops.plan.id` | `QASE_TESTOPS_PLAN_ID` | undefined | No | Any integer |
49+
| Size of batch for sending test results | `testops.batch.size` | `QASE_TESTOPS_BATCH_SIZE` | `200` | No | Any integer |
50+
| Enable defects for failed test cases | `testops.defect` | `QASE_TESTOPS_DEFECT` | `False` | No | `True`, `False` |
51+
52+
### Example `qase.config.json` config:
53+
54+
```json
55+
{
56+
"mode": "testops",
57+
"fallback": "report",
58+
"debug": false,
59+
"environment": "local",
60+
"captureLogs": false,
61+
"report": {
62+
"driver": "local",
63+
"connection": {
64+
"local": {
65+
"path": "./build/qase-report",
66+
"format": "json"
67+
}
68+
}
69+
},
70+
"testops": {
71+
"api": {
72+
"token": "<token>",
73+
"host": "qase.io"
74+
},
75+
"run": {
76+
"title": "Regress run",
77+
"description": "Regress run description",
78+
"complete": true
79+
},
80+
"defect": false,
81+
"project": "<project_code>",
82+
"batch": {
83+
"size": 100
84+
}
85+
}
86+
}
87+
```

composer.json

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
11
{
2-
"name": "qase/php-commons",
3-
"description": "Library with common classes for Qase reporters",
4-
"homepage": "https://developers.qase.io",
5-
"type": "library",
6-
"license": "Apache-2.0",
7-
"authors": [
8-
{
9-
"name": "Nikita Fedorov",
10-
"email": "nik333r@gmail.com"
11-
}
12-
],
13-
"keywords": [
14-
"qase",
15-
"tms",
16-
"reporter",
17-
"php",
18-
"testops"
19-
],
20-
"autoload": {
21-
"psr-4": {
22-
"Qase\\PhpCommons\\": "src/"
23-
}
2+
"name": "qase/qase-php-commons",
3+
"description": "Library with common classes for Qase PHP reporters",
4+
"homepage": "https://qase.io",
5+
"license": "Apache-2.0",
6+
"type": "library",
7+
"keywords": [
8+
"qase",
9+
"tms",
10+
"reporter",
11+
"common",
12+
"php"
13+
],
14+
"authors": [
15+
{
16+
"name": "Qase Team",
17+
"email": "support@qase.io"
18+
}
19+
],
20+
"autoload": {
21+
"psr-4": {
22+
"Qase\\PhpCommons\\": "src/"
23+
}
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"Tests\\": "tests/"
28+
}
29+
},
30+
"require": {
31+
"php": "^8.0",
32+
"qase/qase-api-client": "^1.0.0",
33+
"qase/qase-api-v2-client": "^1.0.0",
34+
"ramsey/uuid": "4.7.*"
35+
},
36+
"require-dev": {
37+
"ext-json": "*",
38+
"phpunit/phpunit": "^9"
39+
},
40+
"scripts": {
41+
"test": "phpunit"
42+
},
43+
"version": "2.0.0",
44+
"config": {
45+
"platform": {
46+
"php": "8.0"
2447
},
25-
"autoload-dev": {
26-
"psr-4": {
27-
"Tests\\": "tests/"
28-
}
48+
"allow-plugins": {
49+
"composer/package-versions-deprecated": true,
50+
"dealerdirect/phpcodesniffer-composer-installer": true
2951
},
30-
"require": {
31-
"php": "^7.4 || ^8.0",
32-
"qase/api": "v1.2.*",
33-
"ramsey/uuid": "4.7.*"
52+
"optimize-autoloader": true,
53+
"preferred-install": {
54+
"*": "dist"
3455
},
35-
"require-dev": {
36-
"phpunit/phpunit": "^8.0 || ^9.0",
37-
"ext-json": "*"
38-
}
56+
"sort-packages": true
57+
}
3958
}

0 commit comments

Comments
 (0)