Skip to content

Commit 59e452f

Browse files
committed
Started with api-functional tests for customer downloadable products
1 parent d42c43b commit 59e452f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\GraphQl\CustomerDownloadableProduct;
9+
10+
use Magento\TestFramework\TestCase\GraphQlAbstract;
11+
12+
class CustomerDownloadableProductTest extends GraphQlAbstract
13+
{
14+
/**
15+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
16+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
17+
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable.php
18+
*/
19+
public function testGetCustomerDownloadableProducts()
20+
{
21+
$query = <<<MUTATION
22+
mutation {
23+
generateCustomerToken(
24+
email: "customer@example.com"
25+
password: "password"
26+
) {
27+
token
28+
}
29+
}
30+
MUTATION;
31+
$response = $this->graphQlMutation($query);
32+
$token = $response['generateCustomerToken']['token'];
33+
$this->headers = ['Authorization' => 'Bearer ' . $token];
34+
35+
$query = <<<QUERY
36+
{
37+
customerDownloadableProducts{
38+
items{
39+
order_increment_id
40+
date
41+
status
42+
download_url
43+
remaining_downloads
44+
}
45+
}
46+
47+
}
48+
QUERY;
49+
50+
$response = $this->graphQlQuery($query, [], '', $this->headers);
51+
}
52+
}

0 commit comments

Comments
 (0)