for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Transaction 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 TransactionTest extends \WP_UnitTestCase {
* Test.
public function test() {
$transaction = new Transaction( '123456', 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);
$transaction->set_brand_id( BrandId::IDEAL );
$transaction->set_purchase_id( 123456 );
$transaction->set_return_url( 'https://example.com/' );
$this->assertInstanceOf( Transaction::class, $transaction );
$this->assertEquals( BrandId::IDEAL, $transaction->get_brand_id() );
// JSON.
$json_file = __DIR__ . '/../json/transaction-request.json';
$json_string = \wp_json_encode( $transaction, \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: