-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
Utilities::include_file()
. (#227)
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
tests/phpunit/tests/Utilities/Utilities_IncludeFileTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} | ||
} |