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