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

tests for wpdesk logging services

parent 02a933f0
No related branches found
No related tags found
2 merge requests!3Devel,!2Feature/tests
<?php
use WPDesk\Logger\LoggerFacade;
use WPDesk\Logger\WPDeskLoggerFactory;
class TestLoggerFacade extends WP_UnitTestCase {
public function tearDown()
{
parent::tearDown();
WPDeskLoggerFactory::tearDown();
}
public function testCanCreateLogger() {
$logger = LoggerFacade::getLogger();
$this->assertSame($logger, LoggerFacade::get_logger(), "Should return same logger instance");
}
}
<?php
use Monolog\Logger;
use WPDesk\Logger\WC\WooCommerceMonologPlugin;
use WPDesk\Logger\WPDeskLoggerFactory;
class TestWPDeskLoggerFactory extends WP_UnitTestCase
{
public function setUp()
{
parent::setUp();
update_option('wpdesk_helper_options', [
'debug_log' => '1'
]);
}
public function tearDown()
{
parent::tearDown();
WPDeskLoggerFactory::tearDown();
}
public function testCanCreateLogger()
{
$factory = new WPDeskLoggerFactory();
$this->assertInstanceOf(Logger::class, $factory->createWPDeskLogger(), "Logger should be created");
$this->assertTrue($factory->isWPDeskLogWorking());
}
public function testWCIsCaptured()
{
(new WPDeskLoggerFactory())->createWPDeskLogger();
$this->assertInstanceOf(WooCommerceMonologPlugin::class, wc_get_logger(), "Logger should be captured.");
}
// public function testErrorsAreCaptured()
// {
//
// }
//
//
// public function testLoggerCanLogWC()
// {
//
// }
//
// public function testLoggerCanLogDirectly()
// {
//
// }
//
// public function testHandleToFile()
// {
//
// }
//
// public function testHandleToWc()
// {
//
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment