Skip to content

Commit

Permalink
Handle multiple file params (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurynas-convertapi authored Jul 18, 2023
1 parent 71cc743 commit 72dc773
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ConvertApi/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ private function normalizedParams()

foreach ($this->params as $key => $val)
{
switch($key) {
case 'File':
switch(true) {
case $key != 'StoreFile' && preg_match('/File$/', $key):
$result[$key] = FileParam::build($val);
break;

case 'Files':
case $key == 'Files':
$result[$key] = $this->filesBatch($val);
break;

Expand Down
12 changes: 12 additions & 0 deletions tests/ConvertApi/ConvertApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ public function testChainedConversion()
$this->assertEquals('test.zip', $result->getFile()->getFileName());
}

public function testCompare()
{
$params = [
'File' => 'examples/files/test.docx',
'CompareFile' => 'examples/files/test.docx'
];

$result = ConvertApi::convert('compare', $params);

$this->assertEquals('test.docx', $result->getFile()->getFileName());
}

public function testApiError()
{
$params = ['Url' => 'https://www.w3.org/TR/PNG/iso_8859-1.txt'];
Expand Down

0 comments on commit 72dc773

Please sign in to comment.