From 599e1c3899146cf69ce9fd6dafc7c9cb283369ee Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Thu, 9 Nov 2023 10:12:24 +0530 Subject: [PATCH] Add unit test --- .../Checks/Plugin_Readme_Check_Tests.php | 16 ++++++++++++++++ .../Checker/Checks/Trademarks_Check_Tests.php | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/tests/phpunit/Checker/Checks/Plugin_Readme_Check_Tests.php b/tests/phpunit/Checker/Checks/Plugin_Readme_Check_Tests.php index 3b1ca8c58..6944db8aa 100644 --- a/tests/phpunit/Checker/Checks/Plugin_Readme_Check_Tests.php +++ b/tests/phpunit/Checker/Checks/Plugin_Readme_Check_Tests.php @@ -181,4 +181,20 @@ public function test_run_root_readme_file_without_errors() { $this->assertEquals( 0, $check_result->get_error_count() ); $this->assertEquals( 0, $check_result->get_warning_count() ); } + + public function test_single_file_plugin_without_error_for_trademarks() { + $readme_check = new Plugin_Readme_Check(); + $check_context = new Check_Context( WP_PLUGIN_DIR . '/single-file-plugin.php' ); + $check_result = new Check_Result( $check_context ); + + $readme_check->run( $check_result ); + + $errors = $check_result->get_errors(); + $warnings = $check_result->get_warnings(); + + $this->assertEmpty( $errors ); + $this->assertEmpty( $warnings ); + $this->assertSame( 0, $check_result->get_error_count() ); + $this->assertSame( 0, $check_result->get_warning_count() ); + } } diff --git a/tests/phpunit/Checker/Checks/Trademarks_Check_Tests.php b/tests/phpunit/Checker/Checks/Trademarks_Check_Tests.php index d6babf67c..1d9976ccf 100644 --- a/tests/phpunit/Checker/Checks/Trademarks_Check_Tests.php +++ b/tests/phpunit/Checker/Checks/Trademarks_Check_Tests.php @@ -108,4 +108,21 @@ public function test_trademarks_with_for_woocommerce_exceptions() { $this->assertEmpty( $errors ); $this->assertSame( 0, $check_result->get_error_count() ); } + + public function test_single_file_plugin_without_error_for_trademarks() { + $trademarks_check = new Trademarks_Check(); + $check_context = new Check_Context( WP_PLUGIN_DIR . '/single-file-plugin.php' ); + $check_result = new Check_Result( $check_context ); + + $trademarks_check->run( $check_result ); + + $errors = $check_result->get_errors(); + $warnings = $check_result->get_warnings(); + + $this->assertEmpty( $errors ); + $this->assertEmpty( $warnings ); + + $this->assertSame( 0, $check_result->get_error_count() ); + $this->assertSame( 0, $check_result->get_warning_count() ); + } }