You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
900B

  1. <?php
  2. class HTMLPurifier_ZipperTest extends HTMLPurifier_Harness
  3. {
  4. public function testBasicNavigation() {
  5. list($z, $t) = HTMLPurifier_Zipper::fromArray(array(0,1,2,3));
  6. $this->assertIdentical($t, 0);
  7. $t = $z->next($t);
  8. $this->assertIdentical($t, 1);
  9. $t = $z->prev($t);
  10. $this->assertIdentical($t, 0);
  11. $t = $z->advance($t, 2);
  12. $this->assertIdentical($t, 2);
  13. $t = $z->delete();
  14. $this->assertIdentical($t, 3);
  15. $z->insertBefore(4);
  16. $z->insertAfter(5);
  17. $this->assertIdentical($z->toArray($t), array(0,1,4,3,5));
  18. list($old, $t) = $z->splice($t, 2, array(6,7));
  19. $this->assertIdentical($old, array(3,5));
  20. $this->assertIdentical($t, 6);
  21. $this->assertIdentical($z->toArray($t), array(0,1,4,6,7));
  22. }
  23. // ToDo: QuickCheck style test comparing with array_splice
  24. }