for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Payment Request Test
*
* @author Pronamic <[email protected]>
* @copyright 2005-2020 Pronamic
* @license GPL-3.0-or-later
* @package Pronamic\WordPress\Pay\Gateways\Payvision
*/
namespace Pronamic\WordPress\Pay\Gateways\Payvision;
* @author Remco Tolsma
* @version 1.0.0
* @since 1.0.0
class PaymentRequestTest extends \WP_UnitTestCase {
* Test.
public function test() {
$header = new RequestHeader( '123456' );
$transaction = new Transaction( '1', 50, 'EUR', '12345678' );
'12345678'
string
object<Pronamic\WordPres...Payvision\TrackingCode>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$payment_request = new PaymentRequest( $header, $transaction );
$bank = new BankDetails();
$bank->set_issuer_id( IssuerIdIDeal::ABN_AMRO );
$payment_request->set_bank( $bank );
$this->assertInstanceOf( PaymentRequest::class, $payment_request );
// JSON.
$json_file = __DIR__ . '/../json/payment-request.json';
$json_string = \wp_json_encode( $payment_request, \JSON_PRETTY_PRINT );
$this->assertJsonStringEqualsJsonFile( $json_file, $json_string );
}
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: