From 1f8e512b013b679d4a6b273fe64c00fceb37dcf6 Mon Sep 17 00:00:00 2001 From: Nicola Mustone Date: Wed, 8 Apr 2015 17:55:19 +0200 Subject: [PATCH] tests WC_Logger --- tests/unit-tests/util/log.php | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/unit-tests/util/log.php diff --git a/tests/unit-tests/util/log.php b/tests/unit-tests/util/log.php new file mode 100644 index 00000000000..a5365bff979 --- /dev/null +++ b/tests/unit-tests/util/log.php @@ -0,0 +1,40 @@ +add( 'unit-tests', 'this is a message' ); + + $this->assertEquals( date( 'm-d-Y @ H:i:s' ) . ' - this is a message' . PHP_EOL, $this->read_content( 'unit-tests' ) ); + } + + /** + * Test clear() + * + * @since 2.4 + */ + public function test_clear() { + $log = new \WC_Logger(); + + $log->add( 'unit-tests', 'this is a message' ); + $log->clear( 'unit-tests' ); + + $this->assertEquals( '', $this->read_content( 'unit-tests' ) ); + } +}