Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix filesystem path creation for nested dirs
- Loading branch information
Vojta Mareš
authored and
Milan Felix Šulc
committed
Nov 8, 2018
1 parent
f7fbbfa
commit bf98965
Showing
2 changed files
with
46 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Cases; | ||
|
||
use Contributte\ImageStorage\Image; | ||
use Ninjify\Nunjuck\TestCase\BaseTestCase; | ||
use Tester\Assert; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
final class ImageTest extends BaseTestCase | ||
{ | ||
|
||
public function testGetPath(): void | ||
{ | ||
$image = new Image(false, '', '/data', '/namespace/47/img.jpg'); | ||
Assert::equal('/data/namespace/47/img.jpg', $image->getPath()); | ||
} | ||
|
||
public function testGetPathNested(): void | ||
{ | ||
$image = new Image(false, '', '/data/images', 'namespace/47/img.jpg'); | ||
Assert::equal('/data/images/namespace/47/img.jpg', $image->getPath()); | ||
} | ||
|
||
public function testCreateLink(): void | ||
{ | ||
$image = new Image(false, 'data', '', 'namespace/47/img.jpg'); | ||
Assert::equal('data/namespace/47/img.jpg', $image->createLink()); | ||
} | ||
|
||
public function testCreateLinkNested(): void | ||
{ | ||
$image = new Image(false, 'data/images', '', 'namespace/47/img.jpg'); | ||
Assert::equal('data/images/namespace/47/img.jpg', $image->createLink()); | ||
} | ||
|
||
} | ||
|
||
(new ImageTest())->run(); |