Skip to content

Commit afbb4f9

Browse files
committed
Reworked test suite to run them via composer.
1 parent 4f430d1 commit afbb4f9

File tree

60 files changed

+78
-88
lines changed

Some content is hidden

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

60 files changed

+78
-88
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,13 @@ jobs:
3434
- name: Install dependencies
3535
run: ./bin/ci/scripts/install_dependencies.sh
3636

37-
- name: Run PHPCS
38-
run: ./vendor/bin/phpcs lib/ --report=summary
39-
40-
- name: Run PHPMD
41-
run: ./vendor/bin/phpmd lib/ ansi phpmd.xml
42-
43-
- name: Run PHPSTAN (lite)
44-
run: ./vendor/bin/phpstan analyse lib/ -l 6 -c phpstan_lite.neon 2>&1
37+
- name: Run QUALITY
38+
run: composer run-script quality
4539

4640
- name: Run TESTS
4741
env:
4842
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
4943
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5044
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
5145
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
52-
run: php -f ./bin/ci/run_tests.php
46+
run: composer run-script tests

.travis.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ php:
2424
- 8.0
2525
- 8.1
2626
- 8.2
27-
# - nightly # nightly is currently too much unstable many bundled extension are not available...
2827
jobs:
2928
fast_finish: true
3029
allow_failures:
@@ -37,6 +36,8 @@ before_install:
3736
# Memcache however seems to be compatible with PHP 7 and 8: https://pecl.php.net/package/memcache
3837
#
3938
# - ./bin/ci/scripts/install_arangodb.sh;
39+
- phpenv config-add bin/ci/php_common.ini
40+
- phpenv config-rm xdebug.ini
4041
- composer install
4142
- composer require phwoolcon/ci-pecl-cacher -n
4243
- "./bin/ci/scripts/install_solr.sh || echo \"Solr install failed\""
@@ -54,13 +55,9 @@ before_install:
5455
- "yes | ./vendor/bin/ci-pecl-install memcache || echo \"PECL Memcache install failed\""
5556
- "yes | ./vendor/bin/ci-pecl-install memcached || echo \"PECL Memcached install failed\""
5657
- "yes | ./vendor/bin/ci-pecl-install couchbase-3.2.2 couchbase || echo \"PECL Couchbase install failed\"" # @todo UPGRADE TO COUCHBASE 4.x.x once we upgraded from Bionic to Focal
57-
- phpenv config-add bin/ci/php_common.ini
58-
- phpenv config-rm xdebug.ini
5958
install:
6059
- "[[ $TRAVIS_PHP_VERSION != \"nightly\" ]] && ./bin/ci/scripts/install_dependencies.sh || ./bin/ci/scripts/install_dependencies_lite.sh"
6160

6261
script:
63-
- ./vendor/bin/phpcs lib/ --report=summary
64-
- ./vendor/bin/phpmd lib/ ansi phpmd.xml
65-
- "[[ $TRAVIS_PHP_VERSION != \"nightly\" ]] && ./vendor/bin/phpstan analyse lib/ -l 6 -c phpstan.neon 2>&1 || ./vendor/bin/phpstan analyse lib/ -l 4 -c phpstan_lite.neon 2>&1"
66-
- php -f ./bin/ci/run_tests.php
62+
- composer run-script quality
63+
- composer run-script tests

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@
2424
"psr/cache": "^2.0||^3.0",
2525
"psr/simple-cache": "^2.0||^3.0",
2626
"ext-mbstring": "*",
27-
"ext-json": "*",
28-
"doctrine/couchdb": "dev-master",
29-
"phpfastcache/phpssdb": "~1.2",
30-
"predis/predis": "~1.1",
31-
"mongodb/mongodb": "~1.9",
32-
"triagens/arangodb": "~3.8",
33-
"aws/aws-sdk-php": "~3.2",
34-
"google/cloud-firestore": "~1.39",
35-
"solarium/solarium": "~6.1",
36-
"symfony/var-dumper": "^6.0"
27+
"ext-json": "*"
3728
},
3829
"require-dev": {
3930
"league/climate": "^3.8",
@@ -83,6 +74,15 @@
8374
"Phpfastcache\\Tests\\": "tests/lib/"
8475
}
8576
},
77+
"scripts": {
78+
"phpcs": "vendor/bin/phpcs lib/ --report=summary",
79+
"phpmd": "vendor/bin/phpmd lib/ ansi phpmd.xml",
80+
"phpstan": "vendor/bin/phpstan analyse lib/ -l 6 -c phpstan.neon",
81+
"quality": ["@phpcs", "@phpmd", "@phpstan"],
82+
"tests": [
83+
"php tests/RunTests.php"
84+
]
85+
},
8686
"support": {
8787
"issues": "https://github.com/PHPSocialNetwork/phpfastcache/issues",
8888
"wiki": "https://github.com/PHPSocialNetwork/phpfastcache/wiki",

bin/ci/run_tests.php renamed to tests/RunTests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
1212
*/
1313
declare(strict_types=1);
14-
require __DIR__ . '/../../vendor/autoload.php';
14+
require __DIR__ . '/../vendor/autoload.php';
1515

16-
define('PFC_TEST_DIR', \realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests'));
16+
define('PFC_TEST_DIR', \realpath(__DIR__));
1717

1818
$timestamp = microtime(true);
1919
$climate = new League\CLImate\CLImate;

tests/cache/cli/Sqlite/db1

28 KB
Binary file not shown.

tests/cache/cli/Sqlite/indexing

20 KB
Binary file not shown.

tests/AbstractProxy.test.php renamed to tests/cases/AbstractProxy.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Phpfastcache\Proxy\PhpfastcacheAbstractProxy;
1818

1919
chdir(__DIR__);
20-
require_once __DIR__ . '/../vendor/autoload.php';
20+
require_once __DIR__ . '/../../vendor/autoload.php';
2121
$testHelper = new TestHelper('phpfastcacheAbstractProxy class');
2222
$defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
2323

tests/Apcu.test.php renamed to tests/cases/Apcu.test.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
use Phpfastcache\Tests\Helper\TestHelper;
1717

1818
chdir(__DIR__);
19-
require_once __DIR__ . '/../vendor/autoload.php';
20-
require_once __DIR__ . '/mock/Autoload.php';
19+
require_once __DIR__ . '/../../vendor/autoload.php';
2120
$testHelper = new TestHelper('Apcu test (CRUD)');
2221
$pool = CacheManager::getInstance('Apcu');
2322
$pool->clear();

tests/Api.test.php renamed to tests/cases/Api.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Phpfastcache\Tests\Helper\TestHelper;
1818

1919
chdir(__DIR__);
20-
require_once __DIR__ . '/../vendor/autoload.php';
20+
require_once __DIR__ . '/../../vendor/autoload.php';
2121
$testHelper = new TestHelper('API class');
2222

2323
/**

tests/Arangodb.test.php renamed to tests/cases/Arangodb.test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Phpfastcache\Tests\Config\ConfigFactory;
2121

2222
chdir(__DIR__);
23-
require_once __DIR__ . '/../vendor/autoload.php';
23+
require_once __DIR__ . '/../../vendor/autoload.php';
2424
$testHelper = new TestHelper('Arangodb driver');
2525

2626
try {

0 commit comments

Comments
 (0)