mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-01-11 07:08:42 +00:00
fix test
This commit is contained in:
parent
8b470d43e5
commit
c13be88579
|
|
@ -21,6 +21,7 @@ use Modules\Billing\Models\BillTypeMapper;
|
|||
use Modules\Billing\Models\SettingsEnum;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\System\OperatingSystem;
|
||||
|
|
@ -103,11 +104,13 @@ final class ApiPurchaseController extends Controller
|
|||
/** @var \Modules\Media\Models\Media[] $uploaded */
|
||||
$uploaded = $mediaResponse->getDataArray('')['response']['upload'];
|
||||
if (empty($uploaded)) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
$in = \reset($uploaded)->getAbsolutePath(); // pdf parsed content is available in $in->content
|
||||
if (!\is_file($in)) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
|
|
@ -135,6 +138,7 @@ final class ApiPurchaseController extends Controller
|
|||
true
|
||||
);
|
||||
} catch (\Throwable $t) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->app->logger->error($t->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ trait ApiPurchaseControllerTrait
|
|||
TestUtils::setMember($request, 'files', $toUpload);
|
||||
|
||||
$this->modulePurchase->apiSupplierBillUpload($request, $response);
|
||||
self::assertEquals('ok', $response->getData('')['status']);
|
||||
self::assertGreaterThan(0, $response->getDataArray('')['response']->id);
|
||||
self::assertEquals(RequestStatusCode::R_200, $response->header->status);
|
||||
|
||||
if (\is_dir(__DIR__ . '/temp')) {
|
||||
Directory::delete(__DIR__ . '/temp');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user