Files
wp-graphql-woocommerce/tests/wpunit/RefundQueriesTest.php
T

87 lines
1.2 KiB
PHP
Raw Normal View History

2019-03-14 23:55:34 -04:00
<?php
2019-03-21 21:43:24 -04:00
class RefundQueriesTest extends \Codeception\TestCase\WPTestCase {
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
public function setUp() {
// before
parent::setUp();
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
// your set up methods here
}
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
public function tearDown() {
// your tear down methods here
// then
parent::tearDown();
}
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
// tests
public function testRefundQuery() {
$query = '
query {
refund(id: " ") {
refundId
dateCreated
amount
reason
refundedBy {
id
}
refundPayment
lineItems {
nodes {
id
}
}
}
}
';
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$actual = do_graphql_request( $query );
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
/**
* use --debug flag to view
*/
\Codeception\Util\Debug::debug( $actual );
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$expected = [];
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$this->assertEquals( $expected, $actual );
}
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
public function testRefundsQuery() {
$query = '
query {
refunds() {
nodes {
refundId
dateCreated
amount
reason
refundedBy {
id
}
refundPayment
lineItems {
nodes {
id
}
}
}
}
}
';
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$actual = do_graphql_request( $query );
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
/**
* use --debug flag to view
*/
\Codeception\Util\Debug::debug( $actual );
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$expected = [];
2019-03-14 23:55:34 -04:00
2019-03-21 21:43:24 -04:00
$this->assertEquals( $expected, $actual );
}
}