From 99ab7b2dfed93dd98c6bed650ba0a04db3fe42ad Mon Sep 17 00:00:00 2001 From: Colin Stewart <79332690+costdev@users.noreply.github.com> Date: Sun, 1 Dec 2024 10:16:03 +0000 Subject: [PATCH] Add tests for `Utilities::include_file()`. (#227) --- .../Utilities/Utilities_IncludeFileTest.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php diff --git a/tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php b/tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php new file mode 100644 index 0000000..4301695 --- /dev/null +++ b/tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php @@ -0,0 +1,37 @@ +assertEmpty( $output ); + } + + /** + * Test that a file is not included when it does not exist. + */ + public function test_should_not_include_file_when_file_does_not_exist() { + $output = get_echo( [ 'AspireUpdate\Utilities', 'include_file' ], [ 'non-existent-file.php' ] ); + $this->assertEmpty( $output ); + } + + /** + * Test that a file is included. + */ + public function test_should_include_file() { + $output = get_echo( [ 'AspireUpdate\Utilities', 'include_file' ], [ 'page-admin-settings.php' ] ); + $this->assertNotEmpty( $output ); + } +}