TextNodeTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Test\Unit;
  3. require_once dirname(__DIR__) . '/Setup.php';
  4. use Test\Setup;
  5. use Braintree;
  6. class TextNodeTest extends Setup
  7. {
  8. public function testIs()
  9. {
  10. $node = new Braintree\TextNode('field');
  11. $node->is('value');
  12. $this->assertEquals(['is' => 'value'], $node->toParam());
  13. }
  14. public function testIsNot()
  15. {
  16. $node = new Braintree\TextNode('field');
  17. $node->isNot('value');
  18. $this->assertEquals(['is_not' => 'value'], $node->toParam());
  19. }
  20. public function testStartsWith()
  21. {
  22. $node = new Braintree\TextNode('field');
  23. $node->startsWith('beginning');
  24. $this->assertEquals(['starts_with' => 'beginning'], $node->toParam());
  25. }
  26. public function testEndsWith()
  27. {
  28. $node = new Braintree\TextNode('field');
  29. $node->endsWith('end');
  30. $this->assertEquals(['ends_with' => 'end'], $node->toParam());
  31. }
  32. public function testContains()
  33. {
  34. $node = new Braintree\TextNode('field');
  35. $node->contains('middle');
  36. $this->assertEquals(['contains' => 'middle'], $node->toParam());
  37. }
  38. }