breakiter_setText_basic.phpt 707 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. IntlBreakIterator::setText(): basic test
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl'))
  6. die('skip intl extension not enabled');
  7. --FILE--
  8. <?php
  9. ini_set("intl.error_level", E_WARNING);
  10. class A {
  11. function __tostring() { return 'aaa'; }
  12. }
  13. $bi = IntlBreakIterator::createWordInstance('pt');
  14. var_dump($bi->setText('foo bar'));
  15. var_dump($bi->getText());
  16. var_dump($bi->setText(1));
  17. var_dump($bi->getText());
  18. var_dump($bi->setText(new A));
  19. var_dump($bi->getText());
  20. /* setText resets the pointer */
  21. var_dump($bi->next());
  22. var_dump($bi->setText('foo bar'));
  23. var_dump($bi->current());
  24. --EXPECT--
  25. bool(true)
  26. string(7) "foo bar"
  27. bool(true)
  28. string(1) "1"
  29. bool(true)
  30. string(3) "aaa"
  31. int(3)
  32. bool(true)
  33. int(0)