Skip to content

Commit dc46cda

Browse files
committed
Merge commit '61d69640dade0f6f22a3d89393718b126c377757' as 'php-server-sdk-shared-tests'
2 parents 4cba8a5 + 61d6964 commit dc46cda

File tree

8 files changed

+555
-0
lines changed

8 files changed

+555
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2.1
2+
3+
workflows:
4+
workflow:
5+
jobs:
6+
- linux-test:
7+
name: PHP 7.3
8+
docker-image: cimg/php:7.3
9+
- linux-test:
10+
name: PHP 7.4
11+
docker-image: cimg/php:7.4
12+
- linux-test:
13+
name: PHP 8.0
14+
docker-image: cimg/php:8.0
15+
16+
jobs:
17+
linux-test:
18+
parameters:
19+
docker-image:
20+
type: string
21+
22+
docker:
23+
- image: <<parameters.docker-image>>
24+
25+
steps:
26+
- checkout
27+
- run:
28+
name: install dependencies
29+
command: composer install --no-progress
30+
- run: mkdir -p ./phpunit
31+
- run:
32+
name: run tests
33+
command: php vendor/bin/phpunit
34+
- store_test_results:
35+
path: ./phpunit
36+
- store_artifacts:
37+
path: ./phpunit
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
composer.lock
3+
phpunit/
4+
.phpunit.result.cache
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2021 Catamorphic, Co.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

php-server-sdk-shared-tests/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# LaunchDarkly Server-Side PHP SDK Shared Test Code
2+
3+
[![CircleCI](https://circleci.com/gh/launchdarkly/php-server-sdk-shared-tests.svg?style=svg)](https://circleci.com/gh/launchdarkly/php-server-sdk-shared-tests)
4+
5+
This project provides support code for testing LaunchDarkly PHP SDK integrations. Feature store implementations, etc., should use this code whenever possible to ensure consistent test coverage and avoid repetition. An example of a project using this code is [php-server-sdk-redis](https://github.com/launchdarkly/php-server-sdk-redis).
6+
7+
The code is not published to Packagist, since it isn't of any use in any non-test context. Instead, it's meant to be used as a Git subtree. Add the subtree to your project like this:
8+
9+
git remote add php-server-sdk-shared-tests [email protected]:launchdarkly/php-server-sdk-shared-tests.git
10+
git subtree add --squash --prefix=php-server-sdk-shared-tests/ php-server-sdk-shared-tests master
11+
12+
Then, in your project that uses the shared tests, add this to `composer.json`:
13+
14+
```json
15+
"repositories": [
16+
{
17+
"type": "path",
18+
"url": "php-server-sdk-shared-tests"
19+
},
20+
],
21+
```
22+
23+
And add this dependency:
24+
25+
```json
26+
"launchdarkly/server-sdk-shared-tests": "dev-master"
27+
```
28+
29+
To update the copy of `php-server-sdk-shared-tests` in your repository to reflect changes in this one:
30+
31+
git subtree pull --squash --prefix=php-server-sdk-shared-tests/ php-server-sdk-shared-tests master
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "launchdarkly/server-sdk-shared-tests",
3+
"description": "Shared unit test code for LaunchDarkly PHP SDK",
4+
"license": "Apache-2.0",
5+
"authors": [
6+
{
7+
"name": "LaunchDarkly <[email protected]>",
8+
"homepage": "http://launchdarkly.com/"
9+
}
10+
],
11+
"require": {
12+
"php": ">=7.3"
13+
},
14+
"require-dev": {
15+
"launchdarkly/server-sdk": "4.*",
16+
"phpunit/phpunit": "^9"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"LaunchDarkly\\SharedTest\\": "src/"
21+
}
22+
},
23+
"autoload-dev": {
24+
"psr-4": {
25+
"LaunchDarkly\\SharedTest\\Tests\\": "tests/"
26+
}
27+
},
28+
"config": {
29+
"sort-packages": true
30+
},
31+
"scripts": {
32+
"cs": "vendor/bin/php-cs-fixer fix --diff --verbose"
33+
}
34+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutResourceUsageDuringSmallTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" verbose="true">
3+
4+
<logging>
5+
<junit outputFile="phpunit/junit.xml"/>
6+
</logging>
7+
8+
<testsuites>
9+
<testsuite name="Unit Tests">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
</phpunit>

0 commit comments

Comments
 (0)