Skip to content

Commit

Permalink
Handle PHP deprecations (#515)
Browse files Browse the repository at this point in the history
* Update deprecated callable use

See https://wiki.php.net/rfc/deprecate_partially_supported_callables

* Update phpunit config
  • Loading branch information
angusmcleod authored Apr 3, 2024
1 parent 5a272ec commit 21a1453
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion lib/discourse.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function initialize_plugin() {
$saved_values = get_option( 'discourse_configurable_text' );
$default_values = $this->discourse_configurable_text;
$merged_values = array_merge( $default_values, $saved_values );
array_walk( $merged_values, 'self::register_text_translations' );
array_walk( $merged_values, self::class . '::register_text_translations' );
update_option( $group_name, $merged_values );
} else {
add_option( $group_name, $this->$group_name );
Expand Down
10 changes: 9 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="tests/phpunit/bootstrap.php" backupGlobals="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" convertDeprecationsToExceptions="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/phpunit/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">lib</directory>
Expand Down
31 changes: 9 additions & 22 deletions tests/phpunit/multisite.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
<?xml version="1.0"?>
<phpunit
bootstrap="bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
convertDeprecationsToExceptions="false"
>
<php>
<const name="WP_TESTS_MULTISITE" value="1" />
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" convertDeprecationsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage/>
<php>
<const name="WP_TESTS_MULTISITE" value="1"/>
</php>
<testsuites>
<testsuite name="multisite">
<directory prefix="test-" suffix=".php">multisite/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<file>lib/discourse-publish.php</file>
<file>lib/sync-discourse-topic.php</file>
</whitelist>
</filter>
<testsuites>
<testsuite name="multisite">
<directory prefix="test-" suffix=".php">multisite/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 21a1453

Please sign in to comment.