Skip to content

Commit

Permalink
Merge commit '61d69640dade0f6f22a3d89393718b126c377757' as 'php-serve…
Browse files Browse the repository at this point in the history
…r-sdk-shared-tests'
  • Loading branch information
eli-darkly committed Aug 7, 2021
2 parents 4cba8a5 + 61d6964 commit dc46cda
Show file tree
Hide file tree
Showing 8 changed files with 555 additions and 0 deletions.
37 changes: 37 additions & 0 deletions php-server-sdk-shared-tests/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2.1

workflows:
workflow:
jobs:
- linux-test:
name: PHP 7.3
docker-image: cimg/php:7.3
- linux-test:
name: PHP 7.4
docker-image: cimg/php:7.4
- linux-test:
name: PHP 8.0
docker-image: cimg/php:8.0

jobs:
linux-test:
parameters:
docker-image:
type: string

docker:
- image: <<parameters.docker-image>>

steps:
- checkout
- run:
name: install dependencies
command: composer install --no-progress
- run: mkdir -p ./phpunit
- run:
name: run tests
command: php vendor/bin/phpunit
- store_test_results:
path: ./phpunit
- store_artifacts:
path: ./phpunit
4 changes: 4 additions & 0 deletions php-server-sdk-shared-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vendor/
composer.lock
phpunit/
.phpunit.result.cache
13 changes: 13 additions & 0 deletions php-server-sdk-shared-tests/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2021 Catamorphic, Co.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
31 changes: 31 additions & 0 deletions php-server-sdk-shared-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# LaunchDarkly Server-Side PHP SDK Shared Test Code

[![CircleCI](https://circleci.com/gh/launchdarkly/php-server-sdk-shared-tests.svg?style=svg)](https://circleci.com/gh/launchdarkly/php-server-sdk-shared-tests)

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).

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:

git remote add php-server-sdk-shared-tests [email protected]:launchdarkly/php-server-sdk-shared-tests.git
git subtree add --squash --prefix=php-server-sdk-shared-tests/ php-server-sdk-shared-tests master

Then, in your project that uses the shared tests, add this to `composer.json`:

```json
"repositories": [
{
"type": "path",
"url": "php-server-sdk-shared-tests"
},
],
```

And add this dependency:

```json
"launchdarkly/server-sdk-shared-tests": "dev-master"
```

To update the copy of `php-server-sdk-shared-tests` in your repository to reflect changes in this one:

git subtree pull --squash --prefix=php-server-sdk-shared-tests/ php-server-sdk-shared-tests master
34 changes: 34 additions & 0 deletions php-server-sdk-shared-tests/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "launchdarkly/server-sdk-shared-tests",
"description": "Shared unit test code for LaunchDarkly PHP SDK",
"license": "Apache-2.0",
"authors": [
{
"name": "LaunchDarkly <[email protected]>",
"homepage": "http://launchdarkly.com/"
}
],
"require": {
"php": ">=7.3"
},
"require-dev": {
"launchdarkly/server-sdk": "4.*",
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
"LaunchDarkly\\SharedTest\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LaunchDarkly\\SharedTest\\Tests\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"cs": "vendor/bin/php-cs-fixer fix --diff --verbose"
}
}
13 changes: 13 additions & 0 deletions php-server-sdk-shared-tests/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<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">

<logging>
<junit outputFile="phpunit/junit.xml"/>
</logging>

<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Loading

0 comments on commit dc46cda

Please sign in to comment.