Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 5db681a

Browse files
author
Andrey Helldar
authored
Merge pull request #32 from TheDragonCode/3.x
Fixed file paths
2 parents f45a055 + 40ad059 commit 5db681a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Services/Syncer.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public function update(?string $filename = null): void
6060
{
6161
$path = $filename ?: $this->sync;
6262

63-
File::store($path, $this->content());
63+
File::store($this->storePath($path), $this->content());
6464
}
6565

6666
public function store(): void
6767
{
68-
File::store($this->storePath(), $this->content());
68+
File::store($this->storePath($this->filename), $this->content());
6969
}
7070

7171
protected function prepared(): Compiler
@@ -99,8 +99,8 @@ protected function compiler(array $items, array $target = []): Compiler
9999
return $this->compiler->items($items, $target);
100100
}
101101

102-
protected function storePath(): string
102+
protected function storePath(string $filename): string
103103
{
104-
return rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $this->filename;
104+
return rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename;
105105
}
106106
}

tests/Unit/MainTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,15 @@ public function testStoring()
4444

4545
public function testSync()
4646
{
47-
$source = __DIR__ . '/../fixtures/source/.env.sync';
48-
$target = __DIR__ . '/../fixtures/expected/expected-sync';
49-
$expected = __DIR__ . '/../fixtures/source/.env.example';
47+
$source = __DIR__ . '/../fixtures/source/.env.sync';
48+
$target = __DIR__ . '/../fixtures/expected/expected-sync';
5049

5150
$service = $this->service();
5251

5352
$service->path($this->path);
5453
$service->filename($this->filename, $source);
5554

56-
$service->update($expected);
55+
$service->update('.env.example');
5756

5857
$this->assertFileEquals($this->expected('expected-sync'), $target);
5958
}

0 commit comments

Comments
 (0)