Skip to content

Commit 69d116e

Browse files
author
Julien Jacottet
committed
fix(upload): keep files and folders starting with a dot
1 parent a1051b8 commit 69d116e

File tree

6 files changed

+42
-0
lines changed

6 files changed

+42
-0
lines changed

src/Automate/Archiver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function archive(string $path, array $exclude = []): \PharData
4141
if (is_dir($path)) {
4242
$finder = new Finder();
4343
$finder->files()
44+
->ignoreDotFiles(false)
4445
->in($path)
4546
->notPath($exclude);
4647

tests/Automate/ArchiverTest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Automate package.
5+
*
6+
* (c) Julien Jacottet <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Automate;
13+
14+
use PHPUnit\Framework\TestCase;
15+
16+
class ArchiverTest extends TestCase
17+
{
18+
private const string PATH = __DIR__.'/../fixtures/folder';
19+
20+
private Archiver $archiver;
21+
22+
protected function setUp(): void
23+
{
24+
$this->archiver = new Archiver();
25+
}
26+
27+
protected function tearDown(): void
28+
{
29+
$this->archiver->clear(self::PATH);
30+
}
31+
32+
public function testArchive(): void
33+
{
34+
$phar = $this->archiver->archive(self::PATH);
35+
36+
$this->assertTrue($phar->offsetExists('tests/fixtures/folder/a.txt'));
37+
$this->assertTrue($phar->offsetExists('tests/fixtures/folder/sub/b.txt'));
38+
$this->assertTrue($phar->offsetExists('tests/fixtures/folder/.sub/c.txt'));
39+
$this->assertTrue($phar->offsetExists('tests/fixtures/folder/.d.txt'));
40+
}
41+
}

tests/fixtures/folder/.d.txt

Whitespace-only changes.

tests/fixtures/folder/.sub/c.txt

Whitespace-only changes.

tests/fixtures/folder/a.txt

Whitespace-only changes.

tests/fixtures/folder/sub/b.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)