-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Document téléchargement response unit tests
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the pappers-library package. | ||
* | ||
* (c) 2023 WEBEWEB | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WBW\Library\Pappers\Tests\Response; | ||
|
||
use Throwable; | ||
use WBW\Library\Pappers\Response\AbstractResponse; | ||
use WBW\Library\Pappers\Response\DocumentTelechargementResponse; | ||
use WBW\Library\Pappers\Tests\AbstractTestCase; | ||
|
||
/** | ||
* Document téléchargement response test. | ||
* | ||
* @author webeweb <https://github.com/webeweb> | ||
* @package WBW\Library\Pappers\Tests\Response | ||
*/ | ||
class DocumentTelechargementResponseTest extends AbstractTestCase { | ||
|
||
/** | ||
* Tests saveAs() | ||
* | ||
* @return void | ||
* @throws Throwable Throws an exception if an error occurs. | ||
*/ | ||
public function testSaveAs(): void { | ||
|
||
// Set a filename mock. | ||
$filename = __DIR__ . "/../../var/cache/DocumentTelechargementResponse.pdf"; | ||
if (true === file_exists($filename)) { | ||
unlink($filename); | ||
} | ||
|
||
$obj = new DocumentTelechargementResponse(); | ||
|
||
$obj->saveAs($filename); | ||
$this->assertFileExists($filename); | ||
} | ||
|
||
/** | ||
* Tests __construct() | ||
* | ||
* @return void | ||
*/ | ||
public function test__construct(): void { | ||
|
||
$obj = new DocumentTelechargementResponse(); | ||
|
||
$this->assertInstanceOf(AbstractResponse::class, $obj); | ||
} | ||
} |