PayPalAccountTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Test\Unit;
  3. require_once dirname(__DIR__) . '/Setup.php';
  4. use Test\Setup;
  5. use Braintree;
  6. class PayPalAccountTest extends Setup
  7. {
  8. public function testGet_givesErrorIfInvalidProperty()
  9. {
  10. $this->setExpectedException('PHPUnit_Framework_Error', 'Undefined property on Braintree\PayPalAccount: foo');
  11. $paypalAccount = Braintree\PayPalAccount::factory([]);
  12. $paypalAccount->foo;
  13. }
  14. public function testIsDefault()
  15. {
  16. $paypalAccount = Braintree\PayPalAccount::factory(['default' => true]);
  17. $this->assertTrue($paypalAccount->isDefault());
  18. $paypalAccount = Braintree\PayPalAccount::factory(['default' => false]);
  19. $this->assertFalse($paypalAccount->isDefault());
  20. }
  21. public function testErrorsOnFindWithBlankArgument()
  22. {
  23. $this->setExpectedException('InvalidArgumentException');
  24. Braintree\PayPalAccount::find('');
  25. }
  26. public function testErrorsOnFindWithWhitespaceArgument()
  27. {
  28. $this->setExpectedException('InvalidArgumentException');
  29. Braintree\PayPalAccount::find(' ');
  30. }
  31. public function testErrorsOnFindWithWhitespaceCharacterArgument()
  32. {
  33. $this->setExpectedException('InvalidArgumentException');
  34. Braintree\PayPalAccount::find('\t');
  35. }
  36. }