ldc-crm/tests/Feature/ApiV2/ArcadiaTest.php
Jérémy Munsch 3619593485 Mise à plat CRM v2
- ajout une colonne new country pour enum
- fix des test v2
- fix du handler
- fix des middleware
- fix du timestamp checker
- fix des stats fix du api handler
- ajout du middleware json only
- remove crm-id du client en faveur du hashcode seulement
- fix du route service provider
- déplacement de la route arcradia en dehors du customer
2021-08-04 13:01:33 +02:00

64 lines
2 KiB
PHP

<?php
namespace Tests\Feature\ApiV2;
use App\Enums\ApiStatus;
use App\Enums\ArcadiaMailType;
use App\Enums\ArcadiaOrderType;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Str;
use Tests\CreatesApplication;
class ArcadiaTest extends ApiBase
{
use CreatesApplication;
use DatabaseTransactions;
/**
* route: apiV2.customer.arcadia.outgoingMail
*/
public function testArcadiaSendOrderDefault()
{
extract($this->getCustomer());
$data = [
'type' => ArcadiaMailType::default()->value,
'operation' => 16,
'label_type_support' => 'Send Departaimants',
'order_date' => \date('Y/m/d H:i:s'),
'state_order' => ArcadiaOrderType::cb()->value,
'support_code' => 32,
'label_type_support' => 'Fond carte Aimanté',
'order_num' => str_pad('23', 9, '0', STR_PAD_LEFT),
'qty' => 1,
'package_unit_weight' => 200,
];
$response = $this->callApiWithToken($service, 'post', route(
'apiV2.arcadia.outgoingMail',
compact('customer')
), $data);
$json = $response->decodeResponseJson();
$this->assertApiResponseStatusIs($json, ApiStatus::OK());
}
public function testArcadiaSendOrderGame()
{
extract($this->getCustomer());
$data = [
'type' => ArcadiaMailType::game()->value,
'operation' => 16,
'order_date' => date('Y/m/d H:i:s'),
'support_code' => 32,
'label_type_support' => 'Jeux Reghalal',
'code_unique' => Str::uuid(),
'code_on_pack' => 'anystring'
];
$response = $this->callApiWithToken($service, 'post', route(
'apiV2.arcadia.outgoingMail',
compact('customer')
), $data);
$json = $response->decodeResponseJson();
$this->assertApiResponseStatusIs($json, ApiStatus::OK());
}
}