DiscountTest.php 928 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Test\Unit;
  3. require_once dirname(__DIR__) . '/Setup.php';
  4. use Test\Setup;
  5. use Braintree;
  6. class DiscountTest extends Setup
  7. {
  8. public function testFactory()
  9. {
  10. $discount = Braintree\Discount::factory([]);
  11. $this->assertInstanceOf('Braintree\Discount', $discount);
  12. }
  13. public function testToString()
  14. {
  15. $discountParams = [
  16. "amount" => "100.00",
  17. "description" => "some description",
  18. "id" => "1",
  19. "kind" => "discount",
  20. "name" => "php_discount",
  21. "neverExpires" => "false",
  22. "numberOfBillingCycles" => "1"
  23. ];
  24. $discount = Braintree\Discount::factory($discountParams);
  25. $this->assertEquals("Braintree\Discount[amount=100.00, description=some description, id=1, kind=discount, name=php_discount, neverExpires=false, numberOfBillingCycles=1]", (string) $discount);
  26. }
  27. }