-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Showing
2 changed files
with
64 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,59 @@ | ||
<?php | ||
|
||
namespace phpMyFAQ\Export\Pdf; | ||
use phpMyFAQ\Translation; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class WrapperTest extends TestCase | ||
{ | ||
private Wrapper $wrapper; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
Translation::create() | ||
->setLanguagesDir(PMF_TRANSLATION_DIR) | ||
->setDefaultLanguage('en') | ||
->setCurrentLanguage('en') | ||
->setMultiByteLanguage(); | ||
|
||
$this->wrapper = new Wrapper(); | ||
} | ||
|
||
public function testConcatenatePathsWithUnixPaths(): void | ||
{ | ||
$path = '/var/www/phpmyfaq'; | ||
|
||
$file = '/content/user/images/test.jpg'; | ||
$expected = '/var/www/phpmyfaq/content/user/images/test.jpg'; | ||
$this->assertEquals($expected, $this->wrapper->concatenatePaths($path, $file)); | ||
} | ||
|
||
public function testConcatenatePathsWithWindowsPaths(): void | ||
{ | ||
$path = 'C:\\xampp\\htdocs\\phpmyfaq'; | ||
|
||
$file = '/content/user/images/test.jpg'; | ||
$expected = 'C:/xampp/htdocs/phpmyfaq/content/user/images/test.jpg'; | ||
$this->assertEquals($expected, $this->wrapper->concatenatePaths($path, $file)); | ||
} | ||
|
||
public function testConcatenatePathsWithMixedPaths(): void | ||
{ | ||
$path = 'C:\\xampp\\htdocs\\phpmyfaq'; | ||
|
||
$file = '/content/user/images/test.jpg'; | ||
$expected = 'C:/xampp/htdocs/phpmyfaq/content/user/images/test.jpg'; | ||
$this->assertEquals($expected, $this->wrapper->concatenatePaths($path, $file)); | ||
} | ||
|
||
public function testConcatenatePathsWithDuplicateRoot(): void | ||
{ | ||
$path = 'C:\\xampp\\htdocs\\phpmyfaq'; | ||
|
||
$file = '/phpmyfaq/content/user/images/test.jpg'; | ||
$expected = 'C:/xampp/htdocs/phpmyfaq/content/user/images/test.jpg'; | ||
$this->assertEquals($expected, $this->wrapper->concatenatePaths($path, $file)); | ||
} | ||
} |