2019-06-27 23:03:10 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use BrunoFontes\Memsource;
|
|
|
|
|
|
|
|
final class BilingualFileTest extends TestCase
|
|
|
|
{
|
|
|
|
public function testEmptyDownloadJobUidListShouldReturnEmptyFilenames()
|
|
|
|
{
|
|
|
|
$api = new Memsource('fakeToken');
|
|
|
|
$this->assertEquals(
|
|
|
|
[],
|
2021-02-11 21:13:38 +00:00
|
|
|
$api->bilingualFile()->download('uid', [], 'filename.xliff')
|
2019-06-27 23:03:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
public function testInvalidDownloadUidsShouldThrowError()
|
|
|
|
{
|
|
|
|
$api = new Memsource('fakeToken');
|
|
|
|
$this->expectException(\Exception::class);
|
2021-02-11 21:13:38 +00:00
|
|
|
$api->bilingualFile()->download('uid', ['a'], 'filename.xliff');
|
2019-06-27 23:03:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testUploadInexistentFileShouldThrowError()
|
|
|
|
{
|
|
|
|
$api = new Memsource('fakeToken');
|
|
|
|
$this->expectException(\Exception::class);
|
|
|
|
$api->bilingualFile()->upload('myInvalidFile', []);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testUploadWithNoTokenShouldThrowError()
|
|
|
|
{
|
|
|
|
$api = new Memsource('fakeToken');
|
|
|
|
$this->expectException(\Exception::class);
|
|
|
|
$api->bilingualFile()->upload('tests/bilingualFileTest.php', []);
|
|
|
|
}
|
|
|
|
}
|