-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0edcf0b
commit dd17304
Showing
9 changed files
with
98 additions
and
46 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
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
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
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,33 @@ | ||
<?php | ||
|
||
namespace Formatter; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
use Sensiolabs\GotenbergBundle\Formatter\AssetBaseDirFormatter; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
#[CoversClass(AssetBaseDirFormatter::class)] | ||
final class AssetBaseDirFormatterTest extends TestCase | ||
{ | ||
/** | ||
* @return iterable<string, array<int, string>> | ||
*/ | ||
public static function generateBaseDirectoryAndPath(): iterable | ||
{ | ||
yield 'absolute path and relative base dir' => [__DIR__.'/../Fixtures/assets/logo.png', '/assets']; | ||
yield 'relative path and absolute base dir' => ['logo.png', __DIR__.'/../Fixtures/assets']; | ||
yield 'relative path and relative base dir' => ['logo.png', 'assets']; | ||
yield 'relative path and relative base dir with end slash' => ['logo.png', 'assets/']; | ||
} | ||
|
||
#[DataProvider('generateBaseDirectoryAndPath')] | ||
public function testResolveWithAbsolutePath(string $path, string $baseDirectory): void | ||
{ | ||
$filesystem = new Filesystem(); | ||
$assetBaseDirFormatter = new AssetBaseDirFormatter($filesystem, __DIR__.'/../Fixtures', $baseDirectory); | ||
$resolvedPath = $assetBaseDirFormatter->resolve($path); | ||
self::assertSame(__DIR__.'/../Fixtures/assets/logo.png', $resolvedPath); | ||
} | ||
} |
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