Skip to content

Commit 8d2cfc4

Browse files
committed
Enhance invoice payment mapping tests to assert non-empty results and correct date formatting
1 parent 4a4328f commit 8d2cfc4

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

tests/test-invoice-generation.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,19 @@ public function test_build_invoice_payments_data_uses_order_creation_date() {
311311
$result = $method->invokeArgs( null, [ $order, $mapping ] );
312312

313313
$this->assertIsArray( $result );
314+
$this->assertNotEmpty( $result );
315+
316+
$payment = $result[0];
317+
314318
$this->assertSame(
315-
wc_format_datetime( $order->get_date_created(), 'y-m-d' ),
316-
$result['date'],
319+
wc_format_datetime( $order->get_date_created(), 'Y-m-d' ),
320+
$payment['date'],
317321
'La fecha del pago debe usar la fecha de creación del pedido'
318322
);
319-
$this->assertSame( 3, $result['account']['id'] );
320-
$this->assertSame( 'transfer', $result['paymentMethod'] );
321-
$this->assertSame( 100000, $result['amount'] );
322-
$this->assertSame( 'COP', $result['currency']['code'] );
323+
$this->assertSame( '3', $payment['account']['id'] );
324+
$this->assertSame( 'transfer', $payment['paymentMethod'] );
325+
$this->assertSame( 100000.0, $payment['amount'] );
326+
$this->assertSame( 'COP', $payment['currency']['code'] );
323327
}
324328

325329
/**

0 commit comments

Comments
 (0)