From a919ed96075e73489b6e3fc0802326ab8cee39a6 Mon Sep 17 00:00:00 2001 From: Georges Date: Wed, 10 Jan 2024 04:18:19 +0100 Subject: [PATCH] Added remote tests --- .github/workflows/php.yml | 7 +++++-- tests/Configs/github-actions.php | 4 ++-- tests/Ravendb.test.php | 11 ----------- tests/Scripts/install_ravendb.sh | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 15 deletions(-) create mode 100755 tests/Scripts/install_ravendb.sh diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 0ad4906..21d0698 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -25,6 +25,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install Couchdb Server + run: ./tests/Scripts/install_ravendb.sh + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -48,5 +51,5 @@ jobs: - name: Run quality tools run: composer run-script quality -# - name: Run tests -# run: composer run-script tests + - name: Run tests + run: composer run-script tests diff --git a/tests/Configs/github-actions.php b/tests/Configs/github-actions.php index ef14caf..078834e 100644 --- a/tests/Configs/github-actions.php +++ b/tests/Configs/github-actions.php @@ -5,6 +5,6 @@ return (new RavendbConfig()) ->setSerializeData(false) ->setItemDetailedDate(true) - ->setHost(['http://127.0.0.1:8082']) - ->setCollectionName('phpfastcache2') + ->setHost([getenv('RAVENDB_TEST_DATABASE_HOSTNAME') ?: 'http://127.0.0.1:8082']) + ->setCollectionName('phpfastcache') ->setDatabaseName('phpfastcache'); diff --git a/tests/Ravendb.test.php b/tests/Ravendb.test.php index 717256f..48ca19a 100644 --- a/tests/Ravendb.test.php +++ b/tests/Ravendb.test.php @@ -13,7 +13,6 @@ */ use Phpfastcache\CacheManager; -use Phpfastcache\EventManager; use Phpfastcache\Exceptions\PhpfastcacheDriverConnectException; use Phpfastcache\Tests\Helper\TestHelper; @@ -26,16 +25,6 @@ } try { -// EventManager::getInstance()->on(['onCouchdbCreateOptions'], static function() use ($testHelper){ -// $args = func_get_args(); -// $eventName = $args[array_key_last($args)]; -// $testHelper->printDebugText( -// sprintf( -// 'Couchdb db event "%s" has been triggered.', -// $eventName -// ) -// ); -// }); $cacheInstance = CacheManager::getInstance('Ravendb', include $configFileName); $testHelper->runCRUDTests($cacheInstance); // $testHelper->runGetAllItemsTests($cacheInstance); diff --git a/tests/Scripts/install_ravendb.sh b/tests/Scripts/install_ravendb.sh new file mode 100755 index 0000000..4e7ad9a --- /dev/null +++ b/tests/Scripts/install_ravendb.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +curl 'http://live-test.ravendb.net/admin/databases?name=phpfastcache&replicationFactor=1' -X PUT \ + -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0' \ + -H 'Accept: */*' \ + -H 'Accept-Language: en-US,en;q=0.5' \ + -H 'Accept-Encoding: gzip, deflate' \ + -H 'Content-Type: application/json; charset=utf-8' \ + -H 'Raven-Studio-Version: 5.4.0.0' \ + -H 'X-Requested-With: XMLHttpRequest' \ + -H 'Origin: http://live-test.ravendb.net' \ + -H 'Connection: keep-alive' \ + -H 'Referer: http://live-test.ravendb.net/studio/index.html' \ + -H 'Pragma: no-cache' \ + -H 'Cache-Control: no-cache' \ + --data-raw '{"DatabaseName":"phpfastcache","Settings":{},"Disabled":false,"Encrypted":false,"Topology":{"DynamicNodesDistribution":false},"Sharding":null}';