Skip to content

Commit

Permalink
[SassTask] [core] - Fixed Filesystem::listContents for numeric filena…
Browse files Browse the repository at this point in the history
…mes. (#1511)
  • Loading branch information
malhusseiny authored Jan 26, 2021
1 parent 9e21c49 commit cb0b46e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Phing/Io/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -869,14 +869,14 @@ public function compareMTimes($file1, $file2)
*/
public function listContents(File $f)
{
return array_keys(
return array_map('strval', array_keys(
iterator_to_array(
new FilesystemIterator(
$f->getAbsolutePath(),
FilesystemIterator::KEY_AS_FILENAME
)
)
);
));
}

/**
Expand Down
12 changes: 12 additions & 0 deletions tests/Phing/Io/FileSystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,16 @@ public function testWhichHinkyExecutableNameWithSeparator()
$path = $fs->which('zx:\tasword.bin');
$this->assertEquals($path, false);
}

public function testListContentsWithNumericName()
{
$fs = FileSystem::getFileSystem();

$parentDir = new File(__DIR__ . '/../../etc/system/io/testdir');
$contents = $fs->listContents($parentDir);

foreach ($contents as $filename) {
self::assertIsString($filename);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ public function testItNotProducesAnyCompiledOutputWhenNoInput(): void

public function testItThrowsExceptionWhenFailOnErrorIsSet(): void
{
$this->expectException(BuildException::class);

$this->compiler->compile(
self::SASS_TEST_BASE . 'non-existing.sass',
self::SASS_TEST_BASE . 'test.css',
true
);

$this->expectException(BuildException::class);

$this->assertFileDoesNotExist(self::SASS_TEST_BASE . 'test.css');
}
}
Empty file added tests/etc/system/io/testdir/111
Empty file.

0 comments on commit cb0b46e

Please sign in to comment.