Skip to content

Commit bb83a9c

Browse files
authored
Enhancement: Split test suite (#940)
1 parent f24c916 commit bb83a9c

File tree

10 files changed

+20
-13
lines changed

10 files changed

+20
-13
lines changed

.github/workflows/integrate.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ jobs:
9595
- name: "Install dependencies with composer"
9696
run: "composer install --ansi --no-interaction --no-progress"
9797

98+
- name: "Run unit tests with phpunit/phpunit"
99+
run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml --testsuite=unit"
100+
98101
- name: "Start built-in web server for PHP"
99102
run: "php -S ${{ env.HTTP_HOST }} .router.php &"
100103

101-
- name: "Run phpunit/phpunit"
102-
run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml"
104+
- name: "Run end-to-end tests with phpunit/phpunit"
105+
run: "vendor/bin/phpunit --colors=always --configuration=tests/phpunit.xml --testsuite=end-to-end"

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix
1818
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --show-progress=dots --verbose
1919

2020
.PHONY: tests
21-
tests: vendor ## Runs tests with phpunit/phpunit
21+
tests: vendor ## Runs unit and end-to-end tests with phpunit/phpunit
22+
vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=unit
2223
rm -rf tests/server.log
23-
tests/server start; vendor/bin/phpunit --configuration=tests/phpunit.xml; tests/server stop
24+
tests/server start; vendor/bin/phpunit --configuration=tests/phpunit.xml --testsuite=end-to-end; tests/server stop
2425

2526
vendor: composer.json composer.lock
2627
composer validate --strict

tests/UserNotes/Sorter/sort-no-notes.phpt renamed to tests/Unit/UserNotes/Sorter/sort-no-notes.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ precision=-1
88
use phpweb\UserNotes\Sorter;
99
use phpweb\UserNotes\UserNote;
1010

11-
require_once __DIR__ . "/../../../src/autoload.php";
11+
require_once __DIR__ . "/../../../../src/autoload.php";
1212

1313
$notes = [];
1414

tests/UserNotes/Sorter/sort-notes-full.phpt renamed to tests/Unit/UserNotes/Sorter/sort-notes-full.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ precision=-1
88
use phpweb\UserNotes\Sorter;
99
use phpweb\UserNotes\UserNote;
1010

11-
require_once __DIR__ . "/../../../src/autoload.php";
11+
require_once __DIR__ . "/../../../../src/autoload.php";
1212

13-
$file = file(__DIR__ . "/../../../backend/notes/d7/d7742c269d23ea86");
13+
$file = file(__DIR__ . "/../../../../backend/notes/d7/d7742c269d23ea86");
1414
$notes = [];
1515
foreach ($file as $line) {
1616
@list($id, $sect, $rate, $ts, $user, $note, $up, $down) = explode("|", $line);

tests/UserNotes/Sorter/sort-single-note-with-no-votes.phpt renamed to tests/Unit/UserNotes/Sorter/sort-single-note-with-no-votes.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ precision=-1
88
use phpweb\UserNotes\Sorter;
99
use phpweb\UserNotes\UserNote;
1010

11-
require_once __DIR__ . "/../../../src/autoload.php";
11+
require_once __DIR__ . "/../../../../src/autoload.php";
1212

1313
$notes = [
1414
new UserNote('1', '', '', '1613487094', '', '', 0, 0),

tests/UserNotes/Sorter/sort-some-notes.phpt renamed to tests/Unit/UserNotes/Sorter/sort-some-notes.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ precision=-1
88
use phpweb\UserNotes\Sorter;
99
use phpweb\UserNotes\UserNote;
1010

11-
require_once __DIR__ . "/../../../src/autoload.php";
11+
require_once __DIR__ . "/../../../../src/autoload.php";
1212

1313
$notes = [
1414
new UserNote('1', '', '', '1613487094', '', '', 0, 2),

tests/clean-anti-spam.phpt renamed to tests/Unit/clean-anti-spam.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ clean_AntiSPAM() removes spam terms
33
--FILE--
44
<?php
55

6-
require_once __DIR__ . '/../include/email-validation.inc';
6+
require_once __DIR__ . '/../../include/email-validation.inc';
77

88
$emails = array (
99

tests/gen-challenge.phpt renamed to tests/Unit/gen-challenge.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ gen_challenge() generates a spam challenge
33
--FILE--
44
<?php
55

6-
require_once __DIR__ . '/../manual/spam_challenge.php';
6+
require_once __DIR__ . '/../../manual/spam_challenge.php';
77

88
mt_srand(9001);
99

tests/is-emailable-address.phpt renamed to tests/Unit/is-emailable-address.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ is_emailable_address() returns whether email is emailable
33
--FILE--
44
<?php
55

6-
require_once __DIR__ . '/../include/email-validation.inc';
6+
require_once __DIR__ . '/../../include/email-validation.inc';
77

88
$emails = array(
99

tests/phpunit.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
</source>
3333
<testsuites>
3434
<testsuite name="end-to-end">
35-
<directory suffix=".phpt">.</directory>
35+
<directory suffix=".phpt">EndToEnd/</directory>
36+
</testsuite>
37+
<testsuite name="unit">
38+
<directory suffix=".phpt">Unit/</directory>
3639
</testsuite>
3740
</testsuites>
3841
</phpunit>

0 commit comments

Comments
 (0)