Skip to content

Commit 90c1768

Browse files
committed
phpunit: Don't worry about markup for payment gateway error messages
Just check for the message text. Fixes #41
1 parent 239b662 commit 90c1768

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tests/phpunit/tests/points/gateways/points.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -503,23 +503,14 @@ protected function simulate_checkout( array $args = array() ) {
503503
$messages = ob_get_clean();
504504

505505
if ( ! empty( $args['expected_errors'] ) ) {
506-
507-
$expected_errors = ' <li>'
508-
. implode( '', (array) $args['expected_errors'] )
509-
. '</li>' . "\n";
510-
506+
$expected_errors = $args['expected_errors'];
511507
} else {
512-
513-
$expected_errors =
514-
' <li>WordPoints_WooCommerce_Points_Gateway_Test</li>'
515-
. "\n";
516-
508+
$expected_errors = 'WordPoints_WooCommerce_Points_Gateway_Test';
517509
}
518510

519-
$this->assertSame(
520-
'<ul class="woocommerce-error">' . "\n" . $expected_errors . ' </ul>'
521-
, trim( $messages )
522-
);
511+
foreach ( (array) $expected_errors as $expected_error ) {
512+
$this->assertStringContains( $expected_error, $messages );
513+
}
523514
}
524515

525516
/**

0 commit comments

Comments
 (0)