woocommerce/tests/unit-tests/crud/refunds.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2016-06-22 15:31:05 +00:00
<?php
/**
2019-07-19 13:19:23 +00:00
* Tests for WC_Order_Refund.
*
2016-06-22 15:31:05 +00:00
* @package WooCommerce\Tests\CRUD
*/
2019-07-19 13:19:23 +00:00
/**
* Tests for WC_Order_Refund.
*/
2016-06-22 15:31:05 +00:00
class WC_Tests_CRUD_Refunds extends WC_Unit_Test_Case {
/**
* Test: get_type
*/
2019-07-19 13:19:23 +00:00
public function test_get_type() {
2016-06-22 15:31:05 +00:00
$object = new WC_Order_Refund();
$this->assertEquals( 'shop_order_refund', $object->get_type() );
}
/**
* Test: get_refund_amount
*/
2019-07-19 13:19:23 +00:00
public function test_get_refund_amount() {
2016-06-22 15:31:05 +00:00
$object = new WC_Order_Refund();
$object->set_amount( 20 );
2019-07-19 01:42:31 +00:00
$this->assertEquals( '20', $object->get_amount() );
2016-06-22 15:31:05 +00:00
}
/**
* Test: get_refund_reason
*/
2019-07-19 13:19:23 +00:00
public function test_get_refund_reason() {
2016-06-22 15:31:05 +00:00
$object = new WC_Order_Refund();
$object->set_reason( 'Customer is an idiot' );
2016-08-22 12:04:57 +00:00
$this->assertEquals( 'Customer is an idiot', $object->get_reason() );
2016-06-22 15:31:05 +00:00
}
/**
* Test: get_refunded_by
*/
2019-07-19 13:19:23 +00:00
public function test_get_refunded_by() {
2016-06-22 15:31:05 +00:00
$object = new WC_Order_Refund();
$object->set_refunded_by( 1 );
$this->assertEquals( 1, $object->get_refunded_by() );
}
2018-03-01 12:12:26 +00:00
/**
* Test: get_refunded_payment
*/
2019-07-19 13:19:23 +00:00
public function test_get_refunded_payment() {
2018-03-01 12:12:26 +00:00
$object = new WC_Order_Refund();
$object->set_refunded_payment( true );
$this->assertEquals( true, $object->get_refunded_payment() );
}
2016-06-22 15:31:05 +00:00
}