diff --git a/phpunit.xml b/phpunit.xml index 3aee4230..a940f772 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,7 +2,11 @@ - ./tests + ./unit_tests/php + + + + diff --git a/tests/EmailTest.php b/unit_tests/php/EmailTest.php similarity index 83% rename from tests/EmailTest.php rename to unit_tests/php/EmailTest.php index c872bc1a..7943b9b5 100644 --- a/tests/EmailTest.php +++ b/unit_tests/php/EmailTest.php @@ -2,8 +2,10 @@ use PHPUnit\Framework\TestCase; -include_once("webui/system/model.php"); -include_once("webui/model/search/search.php"); +define('DIR_BASE', $_ENV['DIR_BASE']); + +include_once(DIR_BASE . "system/model.php"); +include_once(DIR_BASE . "model/search/search.php"); final class SearchSearchTest extends TestCase { diff --git a/tests/FormatTest.php b/unit_tests/php/FormatTest.php similarity index 100% rename from tests/FormatTest.php rename to unit_tests/php/FormatTest.php diff --git a/tests/ParseMessageTest.php b/unit_tests/php/ParseMessageTest.php similarity index 90% rename from tests/ParseMessageTest.php rename to unit_tests/php/ParseMessageTest.php index 3d16e275..a1e10516 100644 --- a/tests/ParseMessageTest.php +++ b/unit_tests/php/ParseMessageTest.php @@ -2,7 +2,10 @@ use PHPUnit\Framework\TestCase; -require_once dirname(dirname(__FILE__)) . '/webui/system/helper/mime.php'; +define('DIR_BASE', $_ENV['DIR_BASE']); +define('TEST_FILES_DIR', $_ENV['TEST_FILES_DIR']); + +require_once DIR_BASE . 'system/helper/mime.php'; final class MailParserTest extends TestCase { @@ -26,7 +29,7 @@ final class MailParserTest extends TestCase { * @dataProvider providerTestParseMessage */ public function test_parse_message($input, $expected_part_count, $expected_body) { - $message = file_get_contents(dirname(dirname(__FILE__)) . "/test_files/" . $input); + $message = file_get_contents(TEST_FILES_DIR . $input); Piler_Mime_Decode::ParseMessage($message, $parts); $this->assertEquals(count($parts), $expected_part_count); diff --git a/tests/SplitMessageTest.php b/unit_tests/php/SplitMessageTest.php similarity index 98% rename from tests/SplitMessageTest.php rename to unit_tests/php/SplitMessageTest.php index dc9d3dc7..e622662f 100644 --- a/tests/SplitMessageTest.php +++ b/unit_tests/php/SplitMessageTest.php @@ -7,7 +7,9 @@ define(THIS_IS_A_TEST, 'This is a test'); use PHPUnit\Framework\TestCase; -require_once dirname(dirname(__FILE__)) . '/webui/system/helper/mime.php'; +define('DIR_BASE', $_ENV['DIR_BASE']); + +require_once DIR_BASE . 'system/helper/mime.php'; final class SplitMessageTest extends TestCase {