diff --git a/.circleci/config.yml b/.circleci/config.yml index 436385e..7497dd5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,9 @@ workflows: - 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: diff --git a/php-server-sdk-shared-tests/.circleci/config.yml b/php-server-sdk-shared-tests/.circleci/config.yml index fbf729f..90e20f1 100644 --- a/php-server-sdk-shared-tests/.circleci/config.yml +++ b/php-server-sdk-shared-tests/.circleci/config.yml @@ -9,6 +9,9 @@ workflows: - 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: diff --git a/php-server-sdk-shared-tests/composer.json b/php-server-sdk-shared-tests/composer.json index 62f1e2a..3ed3093 100644 --- a/php-server-sdk-shared-tests/composer.json +++ b/php-server-sdk-shared-tests/composer.json @@ -1,4 +1,10 @@ { + "repositories": [ + { + "type": "git", + "url": "https://github.com/launchdarkly/php-server-sdk-private.git" + } + ], "name": "launchdarkly/server-sdk-shared-tests", "description": "Shared unit test code for LaunchDarkly PHP SDK", "license": "Apache-2.0", @@ -12,7 +18,7 @@ "php": ">=7.3" }, "require-dev": { - "launchdarkly/server-sdk": ">=3.9", + "launchdarkly/server-sdk": "4.0.x-dev", "phpunit/phpunit": "^9" }, "autoload": { diff --git a/php-server-sdk-shared-tests/src/DatabaseFeatureRequesterTestBase.php b/php-server-sdk-shared-tests/src/DatabaseFeatureRequesterTestBase.php index 0c82c47..bb3a65f 100644 --- a/php-server-sdk-shared-tests/src/DatabaseFeatureRequesterTestBase.php +++ b/php-server-sdk-shared-tests/src/DatabaseFeatureRequesterTestBase.php @@ -2,15 +2,15 @@ namespace LaunchDarkly\SharedTest; -use LaunchDarkly\FeatureFlag; use LaunchDarkly\FeatureRequester; -use LaunchDarkly\Segment; +use LaunchDarkly\Impl\Model\FeatureFlag; +use LaunchDarkly\Impl\Model\Segment; use PHPUnit\Framework\TestCase; /** * A base class providing standardized PHPUnit tests for database integrations. */ -class DatabaseFeatureRequesterTestBase extends \PHPUnit\Framework\TestCase +class DatabaseFeatureRequesterTestBase extends TestCase { const TEST_PREFIX = 'testprefix'; diff --git a/php-server-sdk-shared-tests/tests/DatabaseFeatureRequesterTestBaseTest.php b/php-server-sdk-shared-tests/tests/DatabaseFeatureRequesterTestBaseTest.php index a6a111d..96a75ad 100644 --- a/php-server-sdk-shared-tests/tests/DatabaseFeatureRequesterTestBaseTest.php +++ b/php-server-sdk-shared-tests/tests/DatabaseFeatureRequesterTestBaseTest.php @@ -2,16 +2,16 @@ namespace LaunchDarkly\SharedTest\Tests; -use LaunchDarkly\FeatureFlag; use LaunchDarkly\FeatureRequester; -use LaunchDarkly\Segment; +use LaunchDarkly\Impl\Model\FeatureFlag; +use LaunchDarkly\Impl\Model\Segment; use LaunchDarkly\SharedTest\DatabaseFeatureRequesterTestBase; class FakeDatabase { public static $data = []; - public static function getItem($prefix, $namespace, $key) + public static function getItem(string $prefix, string $namespace, string $key): ?array { $dataSet = self::$data[$prefix] ?? null; if ($dataSet) { @@ -24,7 +24,7 @@ public static function getItem($prefix, $namespace, $key) return null; } - public static function getAllItems($prefix, $namespace) + public static function getAllItems(string $prefix, string $namespace): array { $itemsOut = []; $dataSet = self::$data[$prefix] ?? []; @@ -35,7 +35,7 @@ public static function getAllItems($prefix, $namespace) return $itemsOut; } - public static function putSerializedItem($prefix, $namespace, $key, $json) + public static function putSerializedItem(string $prefix, string $namespace, string $key, string $json): void { if (!isset(self::$data[$prefix])) { self::$data[$prefix] = []; @@ -56,7 +56,7 @@ public function __construct($prefix) $this->prefix = $prefix; } - public function getFeature($key) + public function getFeature(string $key): ?FeatureFlag { $json = FakeDatabase::getItem($this->prefix, 'features', $key); if ($json) { @@ -66,7 +66,7 @@ public function getFeature($key) return null; } - public function getSegment($key) + public function getSegment(string $key): ?Segment { $json = FakeDatabase::getItem($this->prefix, 'segments', $key); if ($json) { @@ -76,7 +76,7 @@ public function getSegment($key) return null; } - public function getAllFeatures() + public function getAllFeatures(): array { $jsonList = FakeDatabase::getAllItems($this->prefix, 'features'); $itemsOut = [];