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

Display the data of the message when a plugin activation fails #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 14 additions & 6 deletions src/WPPPB/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,20 @@ public function phpunit_compat() {

if ( class_exists( 'PHPUnit\Runner\Version' ) ) {

/**
* Compatibility with PHPUnit 6+.
*
* @since 0.3.2
*/
require_once $this->get_wp_tests_dir() . '/includes/phpunit6-compat.php';
if ( file_exists( $this->get_wp_tests_dir() . '/includes/phpunit6-compat.php' ) ) {
/**
* Compatibility with PHPUnit 6+.
*
* @since 0.3.2
*/
require_once $this->get_wp_tests_dir() . '/includes/phpunit6-compat.php';
}
if ( file_exists( $this->get_wp_tests_dir() . '/includes/phpunit6/compat.php' ) ) {
/**
* Compatibility with PHPUnit 6+ for WP 5.1.
*/
require_once $this->get_wp_tests_dir() . '/includes/phpunit6/compat.php';
}

class_alias(
'PHPUnit\Framework\Constraint\Constraint'
Expand Down
8 changes: 6 additions & 2 deletions src/bin/install-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@

echo "Error: Plugin activation failed for {$plugin}:" . PHP_EOL;

foreach ( $result->get_error_messages() as $message ) {
echo "- {$message}" . PHP_EOL;
foreach ($result->get_error_codes() as $code) {
echo "- " . $result->get_error_message( $code ) . PHP_EOL;
$data = $result->get_error_data( $code );
if ( ! empty( $data ) && is_string( $data ) ) {
echo "Data: " . $data;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Tofandel ! Sorry for the delay in reviewing it.

This looks good, except maybe there needs to be a new line output after the data. What do you think?

Suggested change
echo "Data: " . $data;
echo "Data: " . $data . PHP_EOL;

}
}

exit( 1 );
Expand Down