FIX: prueba Servicio Customer

This commit is contained in:
Juan Pablo Vial
2025-05-08 17:17:24 -04:00
parent e239669839
commit 26b6862955

View File

@ -44,15 +44,24 @@ class CustomerTest extends TestCase
$persona->apellidoPaterno = $faker->lastName(); $persona->apellidoPaterno = $faker->lastName();
$persona->apellidoMaterno = $faker->lastName(); $persona->apellidoMaterno = $faker->lastName();
$persona->method('datos')->willReturn($datos); $persona->method('datos')->willReturn($datos);
$persona->method('nombreCompleto')->willReturn(implode(' ', [
$persona->nombres,
$persona->apellidoPaterno,
$persona->apellidoMaterno
]));
$this->customer = $this->getMockBuilder(Model\MediosPago\Toku\Customer::class) $this->customer = $this->getMockBuilder(Model\MediosPago\Toku\Customer::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->customer->id = $faker->randomNumber(); $this->customer->id = $faker->randomNumber();
$this->customer->persona = $persona; $this->customer->persona = $persona;
$this->customer->toku_id = $faker->ean13(); $this->customer->toku_id = $faker->ean13();
$this->customer->method('rut')->willReturn(implode('', [
$persona->rut,
strtoupper($persona->digito)
]));
$this->customer->method('jsonSerialize')->willReturn([ $this->customer->method('jsonSerialize')->willReturn([
'id' => $this->customer->id, 'id' => $this->customer->id,
'rut' => implode('', [$persona->rut, $persona->digito]), 'rut' => $this->customer->rut(),
'toku_id' => $this->customer->toku_id 'toku_id' => $this->customer->toku_id
]); ]);
@ -63,10 +72,10 @@ class CustomerTest extends TestCase
$this->getData = [ $this->getData = [
'id' => $this->customer->id, 'id' => $this->customer->id,
'external_id' => implode('', [$persona->rut, $persona->digito]), 'external_id' => $this->customer->rut(),
'government_id' => implode('', [$persona->rut, $persona->digito]), 'government_id' => $this->customer->rut(),
'email' => $persona->datos()->email, 'email' => $persona->datos()->email,
'name' => implode(' ', [$persona->nombres, $persona->apellidoPaterno, $persona->apellidoMaterno]), 'name' => $persona->nombreCompleto(),
'phone_number' => $persona->datos()->telefono, 'phone_number' => $persona->datos()->telefono,
'silenced_until' => null, 'silenced_until' => null,
'default_agent' => null, 'default_agent' => null,
@ -92,10 +101,10 @@ class CustomerTest extends TestCase
$this->postData = [ $this->postData = [
'id' => $this->customer->id, 'id' => $this->customer->id,
'external_id' => implode('', [$persona->rut, $persona->digito]), 'external_id' => $this->customer->rut(),
'government_id' => implode('', [$persona->rut, $persona->digito]), 'government_id' => $this->customer->rut(),
'email' => $persona->datos()->email, 'email' => $persona->datos()->email,
'name' => implode(' ', [$persona->nombres, $persona->apellidoPaterno, $persona->apellidoMaterno]), 'name' => $persona->nombreCompleto(),
'phone_number' => $persona->datos()->telefono, 'phone_number' => $persona->datos()->telefono,
'silenced_until' => null, 'silenced_until' => null,
'default_agent' => null, 'default_agent' => null,