Skip to content

Commit

Permalink
Update PHPUnit stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Oct 13, 2023
1 parent eb2af36 commit bce32bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
/wordpress/

# PHPUnit
/.phpunit.cache/
/.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"pronamic/wp-coding-standards": "^2.0",
"roots/wordpress": "^6.0",
"vlucas/phpdotenv": "^2.0",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^2.0"
},
"scripts": {
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-clover build/logs/clover.xml --coverage-text",
Expand Down
41 changes: 15 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
<?xml version="1.0"?>

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<testsuites>
<testsuite name="WordPress DateTime test Suite">
<directory suffix=".php">./tests/src</directory>
</testsuite>
</testsuites>

<php>
<env name="WP_PHPUNIT__TESTS_CONFIG" value="tests/wp-config.php"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/bootstrap.php" backupGlobals="false" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage/>
<testsuites>
<testsuite name="WordPress DateTime test Suite">
<directory suffix=".php">./tests/src</directory>
</testsuite>
</testsuites>
<php>
<env name="WP_PHPUNIT__TESTS_CONFIG" value="tests/wp-config.php"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions tests/src/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function test_format_i18n( $locale, $wp_timezone, $wp_gmt_offset, $expect
*
* @return array
*/
public function provider_test_format_i18n() {
public static function provider_test_format_i18n() {
return [
// Dutch.
[ 'nl_NL', 'UTC', null, '2015-05-05 mei 13:00:00 +00:00 UTC UTC', '2015-05-05 15:00:00', 'Europe/Amsterdam' ],
Expand Down Expand Up @@ -102,7 +102,7 @@ public function test_create_from_format( $format, $time, $timezone, $expected )
*
* @return array
*/
public function provider_create_from_format() {
public static function provider_create_from_format() {
return [
[ 'j-M-Y H:i:s', '15-Feb-2009 10:00:00', null, '2009-02-15T10:00:00+00:00' ],
[ 'j-M-Y H:i:s', '15-Feb-2009 10:00:00', new DateTimeZone( 'Europe/Amsterdam' ), '2009-02-15T10:00:00+01:00' ],
Expand Down
4 changes: 2 additions & 2 deletions tests/src/DateTimeZoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function test_get_default( $wp_timezone, $wp_gmt_offset, $expected ) {
*
* @return array
*/
public function provider_test_get_default() {
public static function provider_test_get_default() {
return [
[ 'UTC', null, 'UTC' ],
[ 'Europe/Amsterdam', null, 'Europe/Amsterdam' ],
Expand Down Expand Up @@ -83,7 +83,7 @@ public function test_offsets( $wp_offset, $php_offset ) {
*
* @return array
*/
public function provider_test_offsets() {
public static function provider_test_offsets() {
return [
[ 12.75, 45900 ],
[ 12.751, 45903 ],
Expand Down

0 comments on commit bce32bc

Please sign in to comment.