szurubooru/tests/Services/FileServiceTest.php
2014-10-18 18:48:18 +02:00

16 lines
575 B
PHP

<?php
namespace Szurubooru\Tests\Services;
class FileServiceTest extends \Szurubooru\Tests\AbstractTestCase
{
public function testSaving()
{
$httpHelper = $this->mock( \Szurubooru\Helpers\HttpHelper::class);
$fileService = new \Szurubooru\Services\FileService($this->getTestDirectory(), $httpHelper);
$input = 'data:text/plain,YXdlc29tZSBkb2c=';
$fileService->saveFromBase64($input, 'dog.txt');
$expected = 'awesome dog';
$actual = file_get_contents($this->getTestDirectory() . DIRECTORY_SEPARATOR . 'dog.txt');
$this->assertEquals($expected, $actual);
}
}