Skip to content

Commit

Permalink
chore: Update PHP tests to handle search methods. (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored Aug 31, 2022
1 parent a759ccc commit aee3aad
Showing 1 changed file with 16 additions and 8 deletions.
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

0 comments on commit aee3aad

Please sign in to comment.