diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47063d1a8..f7cdabb5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,17 +15,17 @@ jobs: uses: actions/checkout@v4 - name: Build Docker Container - run: docker compose -f docker-compose.yml build >/dev/null + run: docker compose -f docker-compose.yml build env: PHP_VERSION: ${{matrix.php}} - name: Composer Install - run: docker compose -f docker-compose.yml run -e PHP_VERSION=${{matrix.php}} test_runner composer install --no-progress + run: docker compose -f docker-compose.yml run test_runner composer install --no-progress --ansi env: PHP_VERSION: ${{matrix.php}} - name: Dump Reflection To File - run: docker compose -f docker-compose.yml run -e PHP_VERSION=${{matrix.php}} php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.json + run: docker compose -f docker-compose.yml run -e PHP_VERSION=${{matrix.php}} php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.dat env: PHP_VERSION: ${{matrix.php}} @@ -40,8 +40,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Build Docker Container + run: docker compose -f docker-compose.yml build test_runner + - name: Composer Install - run: docker compose -f docker-compose.yml run test_runner composer install --no-progress + run: docker compose -f docker-compose.yml run test_runner composer install --no-progress --ansi - name: Test PhpDoc run: docker compose -f docker-compose.yml run test_runner vendor/bin/phpunit --no-progress --testsuite PhpDoc diff --git a/.github/workflows/testPeclExtensions.yml b/.github/workflows/testPeclExtensions.yml index c77af4a4d..c75853011 100644 --- a/.github/workflows/testPeclExtensions.yml +++ b/.github/workflows/testPeclExtensions.yml @@ -24,7 +24,7 @@ jobs: run: docker compose -f docker-compose.yml run pecl_extensions /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionDataPecl.json - name: Dump Reflection Without Pecl To File - run: docker compose -f docker-compose.yml run php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.json + run: docker compose -f docker-compose.yml run php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.dat - name: Build Reflection Data With Pecl Only run: docker compose -f docker-compose.yml run php_under_test /usr/local/bin/php tests/Tools/dump-pecl-to-file.php diff --git a/.gitignore b/.gitignore index d55334171..68368da17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,13 @@ +# Editor +.idea/ + # Datasource local storage ignored files -.idea/dataSources dataSources.local.xml # Editor-based HTTP Client requests http-client.private.env.json -.idea/httpRequests rest-client.private.env.json -# Default ignored files -.idea/workspace.xml -.idea/shelf - # PHPUnit phpunit.xml @@ -20,4 +17,4 @@ vendor .php_cs.cache .phpunit.result.cache -ReflectionData.json +ReflectionData.dat diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba45..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index a7b0332eb..000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b312839b..000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index de37c3af0..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/php-docker-settings.xml b/.idea/php-docker-settings.xml deleted file mode 100644 index b6f01257b..000000000 --- a/.idea/php-docker-settings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml deleted file mode 100644 index 35cd1bbeb..000000000 --- a/.idea/php-test-framework.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index ce0f90b44..000000000 --- a/.idea/php.xml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/phpstorm-stubs.iml b/.idea/phpstorm-stubs.iml deleted file mode 100644 index 7526667fe..000000000 --- a/.idea/phpstorm-stubs.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/AllTests.xml b/.idea/runConfigurations/AllTests.xml deleted file mode 100644 index 344b4332b..000000000 --- a/.idea/runConfigurations/AllTests.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/.idea/runConfigurations/AllTestsWithCheckLinks.xml b/.idea/runConfigurations/AllTestsWithCheckLinks.xml deleted file mode 100644 index 31a7bbf30..000000000 --- a/.idea/runConfigurations/AllTestsWithCheckLinks.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Core/Core.php b/Core/Core.php old mode 100755 new mode 100644 diff --git a/Core/Core_d.php b/Core/Core_d.php old mode 100755 new mode 100644 diff --git a/README.md b/README.md index f6f3df7b2..2b77f301a 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,17 @@ Have a full copy of the .git repo within an IDE and provide its path in `Setting The set of extensions enabled by default in PhpStorm can change anytime without prior notice. To learn how to view the enabled extensions, look [here](https://blog.jetbrains.com/phpstorm/2017/03/per-project-php-extension-settings-in-phpstorm-2017-1/). ### How to run tests -1. Execute `docker compose -f docker-compose.yml run test_runner composer install --ignore-platform-reqs` -2. Execute `docker compose -f docker-compose.yml run -e PHP_VERSION=8.0 test_runner vendor/bin/phpunit --testsuite PHP_8.0` +Use the provided script, which provides proper setup, for running tests: +```shell +./runTests.sh 8.0 8.1 +``` +_In that case, tests will run for PHP 8.0 and 8.1. Not providing such parameters will make it run on all supported PHP versions._ ### How to update stub map -Execute `docker compose -f docker-compose.yml run test_runner /usr/local/bin/php tests/Tools/generate-stub-map` and commit the resulting `PhpStormStubsMap.php` +Run the stub map generator and commit the resulting `PhpStormStubsMap.php`: +```shell +docker compose -f docker-compose.yml run test_runner /usr/local/bin/php tests/Tools/generate-stub-map +``` ### License [Apache 2] diff --git a/rdkafka/RdKafka.php b/rdkafka/RdKafka.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Conf.php b/rdkafka/RdKafka/Conf.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Consumer.php b/rdkafka/RdKafka/Consumer.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/ConsumerTopic.php b/rdkafka/RdKafka/ConsumerTopic.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Exception.php b/rdkafka/RdKafka/Exception.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/KafkaConsumer.php b/rdkafka/RdKafka/KafkaConsumer.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/KafkaConsumerTopic.php b/rdkafka/RdKafka/KafkaConsumerTopic.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Message.php b/rdkafka/RdKafka/Message.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Metadata.php b/rdkafka/RdKafka/Metadata.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Metadata/Collection.php b/rdkafka/RdKafka/Metadata/Collection.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Metadata/Partition.php b/rdkafka/RdKafka/Metadata/Partition.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Metadata/Topic.php b/rdkafka/RdKafka/Metadata/Topic.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Producer.php b/rdkafka/RdKafka/Producer.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/ProducerTopic.php b/rdkafka/RdKafka/ProducerTopic.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Queue.php b/rdkafka/RdKafka/Queue.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/Topic.php b/rdkafka/RdKafka/Topic.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/TopicConf.php b/rdkafka/RdKafka/TopicConf.php old mode 100755 new mode 100644 diff --git a/rdkafka/RdKafka/TopicPartition.php b/rdkafka/RdKafka/TopicPartition.php old mode 100755 new mode 100644 diff --git a/rdkafka/constants.php b/rdkafka/constants.php old mode 100755 new mode 100644 diff --git a/rdkafka/functions.php b/rdkafka/functions.php old mode 100755 new mode 100644 diff --git a/redis/RedisSentinel.php b/redis/RedisSentinel.php old mode 100755 new mode 100644 diff --git a/runTests.sh b/runTests.sh old mode 100755 new mode 100644 index aff854a39..414515e52 --- a/runTests.sh +++ b/runTests.sh @@ -1,20 +1,38 @@ #!/usr/bin/env bash + echo "Installing composer packages..." -docker-compose -f docker-compose.yml run test_runner composer install --ignore-platform-reqs -echo "Checking stub map..." -docker-compose -f docker-compose.yml run test_runner vendor/bin/phpunit --testsuite Check_Stub_Map -phpVersions=("7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5") +docker-compose -f docker-compose.yml run test_runner composer install + +echo "Checking PhpDoc..." +docker-compose -f docker-compose.yml run test_runner vendor/bin/phpunit --testsuite PhpDoc + +echo "Checking Structure..." +docker compose -f docker-compose.yml run test_runner vendor/bin/phpunit --testsuite Structure + +allPhpVersions=("7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4" "8.5") +phpVersions=("$@") +if [ ${#phpVersions[@]} -eq 0 ]; then + phpVersions=("${allPhpVersions[@]}") +fi + for i in "${phpVersions[@]}" do export PHP_VERSION=$i SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd "$SCRIPT_DIR" || exit + echo "Building docker container for PHP_$i..." - docker-compose -f docker-compose.yml build - echo "Dumping reflection data to file $SCRIPT_DIR/ReflectionData.json for PHP_$i..." - docker-compose -f docker-compose.yml run -e PHP_VERSION="$i" php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.json - echo "Running tests agains PHP_$i..." - docker-compose -f docker-compose.yml run -e PHP_VERSION="$i" test_runner vendor/bin/phpunit --testsuite PHP_"$i" - echo "Removing file $SCRIPT_DIR/ReflectionData.json with reflection data for PHP_$i..." - rm -f "$SCRIPT_DIR/ReflectionData.json" + docker compose -f docker-compose.yml build + + echo "Installing composer packages..." + docker compose -f docker-compose.yml run test_runner composer install + + echo "Dumping reflection data to file $SCRIPT_DIR/ReflectionData.dat for PHP_$i..." + docker compose -f docker-compose.yml run -e "PHP_VERSION=$i" php_under_test /usr/local/bin/php tests/Tools/dump-reflection-to-file.php ReflectionData.dat + + echo "Running tests against PHP_$i..." + docker compose -f docker-compose.yml run -e "PHP_VERSION=$i" test_runner vendor/bin/phpunit --testsuite "PHP_$i" + + echo "Removing file $SCRIPT_DIR/ReflectionData.dat with reflection data for PHP_$i..." + rm -f "$SCRIPT_DIR/ReflectionData.dat" done diff --git a/tests/DockerImages/testRunner/Dockerfile b/tests/DockerImages/testRunner/Dockerfile index 35eb8dfab..d27ae46ce 100644 --- a/tests/DockerImages/testRunner/Dockerfile +++ b/tests/DockerImages/testRunner/Dockerfile @@ -31,4 +31,7 @@ RUN docker-php-ext-install gmp sockets intl gd ldap bz2 mysqli bcmath calendar d #RUN echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini #RUN echo "xdebug.output_dir=/opt/project/xdebug_snapshots" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini #RUN echo "xdebug.log=/opt/project/phpstorm-stubs/xdebug_logs/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + +RUN git config --global --add safe.directory /opt/project/phpstorm-stubs + WORKDIR /opt/project/phpstorm-stubs diff --git a/tests/Parsers/PHPReflectionParser.php b/tests/Parsers/PHPReflectionParser.php index 11e5caa0d..432f2b43f 100644 --- a/tests/Parsers/PHPReflectionParser.php +++ b/tests/Parsers/PHPReflectionParser.php @@ -22,8 +22,8 @@ class PHPReflectionParser */ public static function getStubs() { - if (file_exists(__DIR__ . '/../../ReflectionData.json')) { - $stubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.json')); + if (file_exists(__DIR__ . '/../../ReflectionData.dat')) { + $stubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.dat')); } else { $stubs = new StubsContainer(); diff --git a/tests/Tools/dump-pecl-to-file.php b/tests/Tools/dump-pecl-to-file.php index b136c02ad..205e3d7ce 100644 --- a/tests/Tools/dump-pecl-to-file.php +++ b/tests/Tools/dump-pecl-to-file.php @@ -6,7 +6,7 @@ require_once __DIR__ . '/../../vendor/autoload.php'; /** @var StubsContainer $coreStubs */ -$coreStubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.json'), ['allowed_classes' => true]); +$coreStubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.dat'), ['allowed_classes' => true]); /** @var StubsContainer $peclAndCoreStubs */ $peclAndCoreStubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionDataPecl.json'), ['allowed_classes' => true]); $onlyPeclStubs = new StubsContainer(); @@ -30,4 +30,4 @@ $onlyPeclStubs->addInterface($peclInterface); } } -file_put_contents(__DIR__ . '/../../ReflectionData.json', serialize($onlyPeclStubs)); +file_put_contents(__DIR__ . '/../../ReflectionData.dat', serialize($onlyPeclStubs));