Skip to content

Commit

Permalink
Add tests for Utilities::include_file(). (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev authored Dec 1, 2024
1 parent f1f7ed5 commit 99ab7b2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Class Utilities_IncludeFileTest
*
* @package AspireUpdate
*/

/**
* Tests for Utilities::include_file()
*
* @covers \AspireUpdate\Utilities::include_file
*/
class Utilities_IncludeFileTest extends WP_UnitTestCase {
/**
* Test that a file is not included when an empty path has been provided.
*/
public function test_should_not_include_file_when_path_is_empty() {
$output = get_echo( [ 'AspireUpdate\Utilities', 'include_file' ], [ '' ] );
$this->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 );
}
}

0 comments on commit 99ab7b2

Please sign in to comment.