Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Split test suite #940

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
'[email protected]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'[email protected]',
Expand Down
5 changes: 4 additions & 1 deletion tests/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Loading