public function testGatewayAll_returnsAllDiscounts()
{
$newId = strval(rand());
$discountParams = ["amount" => "100.00", "description" => "some description", "id" => $newId, "kind" => "discount", "name" => "php_discount", "neverExpires" => "false", "numberOfBillingCycles" => "1"];
$http = new Braintree\Http(Braintree\Configuration::$global);
$path = Braintree\Configuration::$global->merchantPath() . "/modifications/create_modification_for_tests";
$http->post($path, ["modification" => $discountParams]);
$gateway = new Braintree\Gateway(['environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key']);
$discounts = $gateway->discount()->all();
foreach ($discounts as $discount) {
if ($discount->id == $newId) {
$actualDiscount = $discount;
}
}
$this->assertNotNull($actualDiscount);
$this->assertEquals($discountParams["amount"], $actualDiscount->amount);
$this->assertEquals($discountParams["id"], $actualDiscount->id);
$this->assertEquals($discountParams["kind"], $actualDiscount->kind);
}