support watermarks

This commit is contained in:
2024-03-18 12:38:14 +00:00
parent 47e1153789
commit 3decfae78f
4 changed files with 143 additions and 5 deletions

View File

@@ -4,13 +4,14 @@ include __DIR__ . '/../vendor/autoload.php';
use Nwb\MultiDownloaderClient\FileRequest;
use Nwb\MultiDownloaderClient\MultiDownloaderClient;
use Nwb\MultiDownloaderClient\Watermark;
use PHPUnit\Framework\TestCase;
class MultiDownloaderClientTest extends TestCase
{
private $testFiles = [
'https://s3.eu-central-1.wasabisys.com/dev-data-nwb/multi-downloader-sat/tests/img/watermarks/portrait.png',
'https://s3.eu-central-1.wasabisys.com/dev-data-nwb/multi-downloader-sat/tests/img/watermarks/paysage.png'
'https://dev-data-nwb.s3.eu-central-1.wasabisys.com/multi-downloader-sat/tests/img/source1.jpg',
'https://dev-data-nwb.s3.eu-central-1.wasabisys.com/multi-downloader-sat/tests/img/Source_portrait_sans_orientation.jpg'
];
private function testFiles()
@@ -19,6 +20,10 @@ class MultiDownloaderClientTest extends TestCase
$file = new FileRequest($url);
$file->getFileOptions()->name('test' . $i . '.png');
$watermark = new Watermark('https://dev-data-nwb.s3.eu-central-1.wasabisys.com/multi-downloader-sat/tests/img/watermarks/watermark.png', 100, 100);
$file->getImageEditOptions()->addWatermark([$watermark]);
return $file;
}, $this->testFiles, array_keys($this->testFiles));
}
@@ -30,7 +35,7 @@ class MultiDownloaderClientTest extends TestCase
$response = $client->downloadAsString();
$md5 = md5($response);
$this->assertEquals('7542c2c2a0750ab9e62d50bbe83d4c1f', $md5);
$this->assertEquals('65b11e1e8b2283f769006cec577ee8e0', $md5);
}
public function testDownloadTo()
@@ -42,7 +47,7 @@ class MultiDownloaderClientTest extends TestCase
$md5 = md5_file($path);
$this->assertFileExists($path);
$this->assertEquals('7542c2c2a0750ab9e62d50bbe83d4c1f', $md5);
$this->assertEquals('65b11e1e8b2283f769006cec577ee8e0', $md5);
}
public function testForm()