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
4 changes: 2 additions & 2 deletions src/Module/Common/FileSystem/FS.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public static function removeDir(Path $path, bool $recursive = true): bool
*
* @param Path $from Source file path
* @param Path $to Destination file path
* @param bool $overwrite Whether to overwrite the destination file if it exists (default: false)
* @param bool $overwrite Whether to overwrite the destination file if it exists (default: true)
*
* @throws \RuntimeException If the move operation fails
*/
public static function moveFile(Path $from, Path $to, bool $overwrite = false): bool
public static function moveFile(Path $from, Path $to, bool $overwrite = true): bool
{
if ($from->absolute() === $to->absolute()) {
return true; // No need to move if paths are the same
Expand Down
28 changes: 28 additions & 0 deletions tests/Acceptance/DLoadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ public function testDownloadsTrapPharSuccessfully(): void
}
}

public function testDownloadsTrapPharSuccessfullyWithForceOption(): void
{
// Arrange
$downloadConfig = new DownloadConfig();
$downloadConfig->software = 'trap';
$downloadConfig->version = '1.13.16';
$downloadConfig->type = Type::Phar;
$downloadConfig->extractPath = (string) $this->destinationDir;

// Act
$this->dload->addTask($downloadConfig);
$this->dload->run();
$this->dload->addTask($downloadConfig, true);
$this->dload->run();

// Assert - Check that trap.phar was downloaded
$expectedPharPath = (string) $this->destinationDir->join('trap.phar');
self::assertFileExists($expectedPharPath, 'Trap PHAR should be downloaded to destination directory');

// Verify the file is not empty
self::assertGreaterThan(1024, \filesize($expectedPharPath), 'Downloaded PHAR should have substantial size');

// Verify file permissions (should be executable)
if (PHP_OS_FAMILY !== 'Windows') {
self::assertTrue(\is_executable($expectedPharPath), 'PHAR file should be executable');
}
}

public function testDownloadsTrapBinary(): void
{
// Arrange
Expand Down
Loading