diff --git a/lib/ConvertApi/Task.php b/lib/ConvertApi/Task.php index cd9b8d7..fca394e 100644 --- a/lib/ConvertApi/Task.php +++ b/lib/ConvertApi/Task.php @@ -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; diff --git a/tests/ConvertApi/ConvertApiTest.php b/tests/ConvertApi/ConvertApiTest.php index 4429f40..3cb76f5 100644 --- a/tests/ConvertApi/ConvertApiTest.php +++ b/tests/ConvertApi/ConvertApiTest.php @@ -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'];