Skip to content
Snippets Groups Projects
Commit f66e8992 authored by dyszczo's avatar dyszczo
Browse files

support for php 5.6 testing

parent 484fd952
No related branches found
No related tags found
1 merge request!8Feature/broken wc logger
Pipeline #6251 failed
...@@ -12,10 +12,9 @@ ...@@ -12,10 +12,9 @@
"monolog/monolog": "^1.23" "monolog/monolog": "^1.23"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6", "phpunit/phpunit": "^5",
"wp-coding-standards/wpcs": "^0.14.1", "wp-coding-standards/wpcs": "^0.14.1",
"squizlabs/php_codesniffer": "^3.0.2", "squizlabs/php_codesniffer": "^3.0.2",
"10up/wp_mock": "^0.3",
"wimg/php-compatibility": "^8" "wimg/php-compatibility": "^8"
}, },
"autoload": { "autoload": {
......
...@@ -33,17 +33,19 @@ class TestWPDeskLoggerFactory extends WP_UnitTestCase ...@@ -33,17 +33,19 @@ class TestWPDeskLoggerFactory extends WP_UnitTestCase
(new WPDeskLoggerFactory())->createWPDeskLogger(); (new WPDeskLoggerFactory())->createWPDeskLogger();
$this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured."); $this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured.");
} }
//
public function testOurLogsGetAllErrors() // This test won't work in PHPUnit 5.x. Enable when support for PHP 5.6 is dropped
{ //
$someMessage = 'whatever'; // public function testOurLogsGetAllErrors()
$errorType = E_USER_NOTICE; // {
// $someMessage = 'whatever';
$logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME); // $errorType = E_USER_NOTICE;
$logger->pushHandler($this->prepareListenHandleThatIsWaitingForMessage('E_USER_NOTICE: ' . $someMessage)); //
$this->expectException(Notice::class); // $logger = (new WPDeskLoggerFactory())->createWPDeskLogger(self::LOGGER_NAME);
trigger_error($someMessage, $errorType); // $logger->pushHandler($this->prepareListenHandleThatIsWaitingForMessage('E_USER_NOTICE: ' . $someMessage));
} // $this->expectException(Notice::class);
// trigger_error($someMessage, $errorType);
// }
/** /**
* Prepares listener that check if logger gets sent message * Prepares listener that check if logger gets sent message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment