0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 18:03:04 +02:00
Commit Graph

2 Commits

Author SHA1 Message Date
Juliette
c576a531b1
PHPMailerLangTest: rename and minor tweaks (#2377)
* PHPMailerLangTest: rename test class to `TranslationCompletenessTest`

As the test class has been moved to a separate directory, we may as well make the class name more descriptive of what the test class actually does.

* TranslationCompletenessTest: various test tweaks

Minor test tweaks:
* Move `@group` tag up to class level.
* Add a `@coversNothing` tag as this test is more a maintainer utility/package test than a test to cover functionality in code.
* Tidy up inline comments.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-06-23 23:04:15 +02:00
Juliette
6372ff87c1
Tests: introduce base testcase and move test classes to subdirectories (#2376)
* Tests/reorganize: add an abstract base testcase

As a first step towards reorganizing the tests, this commit:
* Creates an abstract base `TestCase` class which can be extended by concrete child test classes and holds the generic properties and helper methods for use throughout the tests.
    Based on their use, the visibility of properties and methods have been adjusted for the new setup.
* Removes the generic property and helper method declarations from the concrete test class.
* Moves the `require` statement for the `validators.php` file to a `set_up_before_class()` method in the base `TestCase`.

* Tests/reorganize: define base directory in set_up_before_class

The `$this->INCLUDE_DIR` property which points to the project root directory does not change at any time during the test run, but was being redefined for every test in the `set_up()` method.

As this is in effect a _constant_ value, let's define it as a constant in the TestCase `set_up_before_class()` method instead.

Notes:
Both actions executed in the `set_up_before_class()` method are typically things for a test bootstrap file.
However, to allow for PHPUnit to be able to run from both a Composer install as well as a Phar file, without having to create custom autoloaders, it is simpler to have the `vendor/autoload.php` file as the bootstrap file as, in that case, PHPUnit will handle the loading order and prevent loading conflicting PHPUnit files from a Composer install when running via the Phar.
With this in mind, putting these actions in a `set_up_before_class()` method is a valid compromise.

* Tests/reorganize: move actual test files to subdirectories

... leaving the test root directory to only contain test utility files.

Note: I've added a second entry for the test generated files to the `.gitignore`. Adding this entry instead of replacing the entry allows for any existing generated files in contributor clones to continue to be ignored.
At a later point in time, it could be elected to remove the original entry, once all active contributors have updated their installs and removed any stray generated files from their `test` root directories.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-06-23 22:43:46 +02:00