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

17 lines
602 B
PHP

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