dict_add_to_personal.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. enchant_dict_add_to_personal() function
  3. --CREDITS--
  4. marcosptf - <marcosptf@yahoo.com.br>
  5. --SKIPIF--
  6. <?php
  7. if(!extension_loaded('enchant')) die('skip, enchant not loader');
  8. if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
  9. if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
  10. ?>
  11. --FILE--
  12. <?php
  13. $broker = enchant_broker_init();
  14. $dicts = enchant_broker_list_dicts($broker);
  15. $newWord = "iLoveJava";
  16. if (is_resource($broker)) {
  17. echo("OK\n");
  18. $requestDict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
  19. if ($requestDict) {
  20. echo("OK\n");
  21. $AddtoPersonalDict = enchant_dict_add_to_personal($requestDict,$newWord);
  22. if (NULL === $AddtoPersonalDict) {
  23. var_dump($AddtoPersonalDict);
  24. } else {
  25. echo("dict add to personal failed\n");
  26. }
  27. } else {
  28. echo("broker request dict failed\n");
  29. }
  30. } else {
  31. echo("broker is not a resource; failed;\n");
  32. }
  33. echo "OK\n";
  34. ?>
  35. --EXPECT--
  36. OK
  37. OK
  38. NULL
  39. OK