Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update PHP tests to handle search methods. #1363

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions tests/Stripe/GeneratedExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ public function testSearchCharge()
$result = $this->client->charges->search(
['query' => 'amount>999 AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Charge","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Charge::class, $result->data[0]);
}

public function testListSession()
Expand Down Expand Up @@ -1337,7 +1338,8 @@ public function testSearchCustomer()
$result = $this->client->customers->search(
['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}

public function testSearchCustomer2()
Expand All @@ -1346,7 +1348,8 @@ public function testSearchCustomer2()
$result = $this->client->customers->search(
['query' => 'name:\'fakename\' AND metadata[\'foo\']:\'bar\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Customer","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Customer::class, $result->data[0]);
}

public function testListDispute()
Expand Down Expand Up @@ -1732,7 +1735,8 @@ public function testSearchInvoice()
$result = $this->client->invoices->search(
['query' => 'total>999 AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Invoice","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Invoice::class, $result->data[0]);
}

public function testListAuthorization()
Expand Down Expand Up @@ -2065,7 +2069,8 @@ public function testSearchPaymentIntent()
$result = $this->client->paymentIntents->search(
['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"PaymentIntent","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\PaymentIntent::class, $result->data[0]);
}

public function testListPaymentLink()
Expand Down Expand Up @@ -2308,7 +2313,8 @@ public function testSearchPrice()
$result = $this->client->prices->search(
['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Price","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Price::class, $result->data[0]);
}

public function testListProduct()
Expand Down Expand Up @@ -2356,7 +2362,8 @@ public function testSearchProduct()
$result = $this->client->products->search(
['query' => 'active:\'true\' AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Product","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Product::class, $result->data[0]);
}

public function testListPromotionCode()
Expand Down Expand Up @@ -3074,7 +3081,8 @@ public function testSearchSubscription()
$result = $this->client->subscriptions->search(
['query' => 'status:\'active\' AND metadata[\'order_id\']:\'6735\'']
);
// TODO: assert proper instance, {"shape":"searchResultObject","type":{"shape":"ref","ref":"Subscription","namespaces":[]},"hasSearchResultType":true}
static::assertInstanceOf(\Stripe\SearchResult::class, $result);
static::assertInstanceOf(\Stripe\Subscription::class, $result->data[0]);
}

public function testListTaxCode()
Expand Down