2014-09-07 00:33:46 +02:00
|
|
|
<?php
|
|
|
|
namespace Szurubooru\Tests\Services;
|
|
|
|
|
|
|
|
class FileServiceTest extends \Szurubooru\Tests\AbstractTestCase
|
|
|
|
{
|
|
|
|
public function testSaving()
|
|
|
|
{
|
2014-09-09 17:49:19 +02:00
|
|
|
$testDirectory = $this->createTestDirectory();
|
2014-09-07 00:33:46 +02:00
|
|
|
$httpHelper = $this->mock( \Szurubooru\Helpers\HttpHelper::class);
|
2014-09-09 17:49:19 +02:00
|
|
|
$fileService = new \Szurubooru\Services\FileService($testDirectory, $httpHelper);
|
2014-09-07 00:33:46 +02:00
|
|
|
$input = 'data:text/plain,YXdlc29tZSBkb2c=';
|
|
|
|
$fileService->saveFromBase64($input, 'dog.txt');
|
|
|
|
$expected = 'awesome dog';
|
2014-09-09 17:49:19 +02:00
|
|
|
$actual = file_get_contents($testDirectory . DIRECTORY_SEPARATOR . 'dog.txt');
|
2014-09-07 00:33:46 +02:00
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
|
|
|
}
|