Author: Andreas Möller (localheinz) Committer: GitHub (web-flow) Pusher: saundefined Date: 2024-02-13T09:38:39+03:00
Commit: https://github.com/php/web-php/commit/bb83a9cc5197e10ebab36e03cb391a6f568e1602 Raw diff: https://github.com/php/web-php/commit/bb83a9cc5197e10ebab36e03cb391a6f568e1602.diff Enhancement: Split test suite (#940) Changed paths: A tests/Unit/UserNotes/Sorter/sort-no-notes.phpt A tests/Unit/UserNotes/Sorter/sort-notes-full.phpt A tests/Unit/UserNotes/Sorter/sort-single-note-with-no-votes.phpt A tests/Unit/UserNotes/Sorter/sort-some-notes.phpt A tests/Unit/clean-anti-spam.phpt A tests/Unit/gen-challenge.phpt A tests/Unit/is-emailable-address.phpt D tests/UserNotes/Sorter/sort-no-notes.phpt D tests/UserNotes/Sorter/sort-notes-full.phpt D tests/UserNotes/Sorter/sort-single-note-with-no-votes.phpt D tests/UserNotes/Sorter/sort-some-notes.phpt D tests/clean-anti-spam.phpt D tests/gen-challenge.phpt D tests/is-emailable-address.phpt M .github/workflows/integrate.yaml M Makefile M tests/phpunit.xml Diff: diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 1813b1d187..2e7b992d09 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -95,8 +95,11 @@ jobs: - name: "Install dependencies with composer" run: "composer install --ansi --no-interaction --no-progress" + - name: "Run unit tests with phpunit/phpunit" + run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml --testsuite=unit" + - name: "Start built-in web server for PHP" run: "php -S ${{ env.HTTP_HOST }} .router.php &" - - name: "Run phpunit/phpunit" - run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml" + - name: "Run end-to-end tests with phpunit/phpunit" + run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml --testsuite=end-to-end" diff --git a/Makefile b/Makefile index c91bc81e22..9589d0f198 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,10 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --show-progress=dots --verbose .PHONY: tests -tests: vendor ## Runs tests with phpunit/phpunit +tests: vendor ## Runs unit and end-to-end tests with phpunit/phpunit + vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=unit rm -rf tests/server.log - tests/server start; vendor/bin/phpunit --configuration=tests/phpunit.xml; tests/server stop + tests/server start; vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=end-to-end; tests/server stop vendor: composer.json composer.lock composer validate --strict diff --git a/tests/UserNotes/Sorter/sort-no-notes.phpt b/tests/Unit/UserNotes/Sorter/sort-no-notes.phpt similarity index 88% rename from tests/UserNotes/Sorter/sort-no-notes.phpt rename to tests/Unit/UserNotes/Sorter/sort-no-notes.phpt index 2bfc988c07..891587b298 100644 --- a/tests/UserNotes/Sorter/sort-no-notes.phpt +++ b/tests/Unit/UserNotes/Sorter/sort-no-notes.phpt @@ -8,7 +8,7 @@ precision=-1 use phpweb\UserNotes\Sorter; use phpweb\UserNotes\UserNote; -require_once __DIR__ . "/../../../src/autoload.php"; +require_once __DIR__ . "/../../../../src/autoload.php"; $notes = []; diff --git a/tests/UserNotes/Sorter/sort-notes-full.phpt b/tests/Unit/UserNotes/Sorter/sort-notes-full.phpt similarity index 98% rename from tests/UserNotes/Sorter/sort-notes-full.phpt rename to tests/Unit/UserNotes/Sorter/sort-notes-full.phpt index 008d790845..b2d3790ec2 100644 --- a/tests/UserNotes/Sorter/sort-notes-full.phpt +++ b/tests/Unit/UserNotes/Sorter/sort-notes-full.phpt @@ -8,9 +8,9 @@ precision=-1 use phpweb\UserNotes\Sorter; use phpweb\UserNotes\UserNote; -require_once __DIR__ . "/../../../src/autoload.php"; +require_once __DIR__ . "/../../../../src/autoload.php"; -$file = file(__DIR__ . "/../../../backend/notes/d7/d7742c269d23ea86"); +$file = file(__DIR__ . "/../../../../backend/notes/d7/d7742c269d23ea86"); $notes = []; foreach ($file as $line) { @list($id, $sect, $rate, $ts, $user, $note, $up, $down) = explode("|", $line); diff --git a/tests/UserNotes/Sorter/sort-single-note-with-no-votes.phpt b/tests/Unit/UserNotes/Sorter/sort-single-note-with-no-votes.phpt similarity index 92% rename from tests/UserNotes/Sorter/sort-single-note-with-no-votes.phpt rename to tests/Unit/UserNotes/Sorter/sort-single-note-with-no-votes.phpt index 2c02366f35..d90e710cfe 100644 --- a/tests/UserNotes/Sorter/sort-single-note-with-no-votes.phpt +++ b/tests/Unit/UserNotes/Sorter/sort-single-note-with-no-votes.phpt @@ -8,7 +8,7 @@ precision=-1 use phpweb\UserNotes\Sorter; use phpweb\UserNotes\UserNote; -require_once __DIR__ . "/../../../src/autoload.php"; +require_once __DIR__ . "/../../../../src/autoload.php"; $notes = [ new UserNote('1', '', '', '1613487094', '', '', 0, 0), diff --git a/tests/UserNotes/Sorter/sort-some-notes.phpt b/tests/Unit/UserNotes/Sorter/sort-some-notes.phpt similarity index 95% rename from tests/UserNotes/Sorter/sort-some-notes.phpt rename to tests/Unit/UserNotes/Sorter/sort-some-notes.phpt index 02f7d53211..9782e362af 100644 --- a/tests/UserNotes/Sorter/sort-some-notes.phpt +++ b/tests/Unit/UserNotes/Sorter/sort-some-notes.phpt @@ -8,7 +8,7 @@ precision=-1 use phpweb\UserNotes\Sorter; use phpweb\UserNotes\UserNote; -require_once __DIR__ . "/../../../src/autoload.php"; +require_once __DIR__ . "/../../../../src/autoload.php"; $notes = [ new UserNote('1', '', '', '1613487094', '', '', 0, 2), diff --git a/tests/clean-anti-spam.phpt b/tests/Unit/clean-anti-spam.phpt similarity index 95% rename from tests/clean-anti-spam.phpt rename to tests/Unit/clean-anti-spam.phpt index a90f128d48..3a4c1f7c0c 100644 --- a/tests/clean-anti-spam.phpt +++ b/tests/Unit/clean-anti-spam.phpt @@ -3,7 +3,7 @@ clean_AntiSPAM() removes spam terms --FILE-- <?php -require_once __DIR__ . '/../include/email-validation.inc'; +require_once __DIR__ . '/../../include/email-validation.inc'; $emails = array ( 'asasasd324...@php.net', diff --git a/tests/gen-challenge.phpt b/tests/Unit/gen-challenge.phpt similarity index 98% rename from tests/gen-challenge.phpt rename to tests/Unit/gen-challenge.phpt index 714985c46c..54cb864ef6 100644 --- a/tests/gen-challenge.phpt +++ b/tests/Unit/gen-challenge.phpt @@ -3,7 +3,7 @@ gen_challenge() generates a spam challenge --FILE-- <?php -require_once __DIR__ . '/../manual/spam_challenge.php'; +require_once __DIR__ . '/../../manual/spam_challenge.php'; mt_srand(9001); diff --git a/tests/is-emailable-address.phpt b/tests/Unit/is-emailable-address.phpt similarity index 94% rename from tests/is-emailable-address.phpt rename to tests/Unit/is-emailable-address.phpt index 315f85585a..d5c39d531b 100644 --- a/tests/is-emailable-address.phpt +++ b/tests/Unit/is-emailable-address.phpt @@ -3,7 +3,7 @@ is_emailable_address() returns whether email is emailable --FILE-- <?php -require_once __DIR__ . '/../include/email-validation.inc'; +require_once __DIR__ . '/../../include/email-validation.inc'; $emails = array( 'asasasd324...@php.net', diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 49a8b0b05e..c8343aa037 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -32,7 +32,10 @@ </source> <testsuites> <testsuite name="end-to-end"> - <directory suffix=".phpt">.</directory> + <directory suffix=".phpt">EndToEnd/</directory> + </testsuite> + <testsuite name="unit"> + <directory suffix=".phpt">Unit/</directory> </testsuite> </testsuites> </phpunit> -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php