Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ parameters:
paths:
- src
- dist-archive-command.php
- tests
scanDirectories:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
- vendor/wp-cli/wp-cli-tests/tests/includes/TestCase.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.parameter
Expand Down
13 changes: 9 additions & 4 deletions tests/Distignore_Filter_Iterator_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Distignore_Filter_Iterator_Test extends TestCase {
/**
* Set up test environment.
*/
public function setUp(): void {
parent::setUp();
protected function set_up() {
parent::set_up();

$this->temp_dir = sys_get_temp_dir() . '/distignore-test-' . uniqid();
mkdir( $this->temp_dir );
Expand All @@ -27,11 +27,11 @@ public function setUp(): void {
/**
* Clean up test environment.
*/
public function tearDown(): void {
protected function tear_down() {
if ( is_dir( $this->temp_dir ) ) {
$this->recursiveDelete( $this->temp_dir );
}
parent::tearDown();
parent::tear_down();
}

/**
Expand Down Expand Up @@ -67,6 +67,7 @@ public function test_filters_ignored_files() {

$files = [];
foreach ( $recursive_iter as $item ) {
$this->assertInstanceOf( SplFileInfo::class, $item );
$files[] = basename( $item->getPathname() );
}

Expand All @@ -92,6 +93,7 @@ public function test_tracks_ignored_directories() {

$files = [];
foreach ( $recursive_iter as $item ) {
$this->assertInstanceOf( SplFileInfo::class, $item );
$relative_path = str_replace( $this->temp_dir, '', $item->getPathname() );
$files[] = $relative_path;
}
Expand Down Expand Up @@ -161,6 +163,7 @@ public function test_has_children_prevents_descent() {

$files = [];
foreach ( $recursive_iter as $item ) {
$this->assertInstanceOf( SplFileInfo::class, $item );
$relative_path = str_replace( $this->temp_dir, '', $item->getPathname() );
$files[] = $relative_path;
}
Expand Down Expand Up @@ -188,6 +191,7 @@ public function test_negation_patterns() {

$files = [];
foreach ( $recursive_iter as $item ) {
$this->assertInstanceOf( SplFileInfo::class, $item );
$relative_path = str_replace( $this->temp_dir, '', $item->getPathname() );
$files[] = $relative_path;
}
Expand Down Expand Up @@ -231,6 +235,7 @@ public function test_nested_directory_filtering() {

$files = [];
foreach ( $recursive_iter as $item ) {
$this->assertInstanceOf( SplFileInfo::class, $item );
$relative_path = str_replace( $this->temp_dir, '', $item->getPathname() );
$files[] = $relative_path;
}
Expand Down
Loading