summaryrefslogtreecommitdiff
path: root/ext/intl/tests
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-05-31 13:02:02 +0200
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-06-04 22:25:08 +0200
commit036b1eb2912872ade10e35f26daf10c65cc3cdea (patch)
treec378f5cbaecbb1a2e4698ebc38249134e7b00573 /ext/intl/tests
parentf5b421621d89c3e87c498ee228c421e67719fbc6 (diff)
downloadphp-git-036b1eb2912872ade10e35f26daf10c65cc3cdea.tar.gz
Tests for (RuleBased)BreakIterator.
Diffstat (limited to 'ext/intl/tests')
-rw-r--r--ext/intl/tests/breakiter___construct.phpt13
-rw-r--r--ext/intl/tests/breakiter___construct_error.phpt35
-rw-r--r--ext/intl/tests/breakiter_clone_basic.phpt23
-rw-r--r--ext/intl/tests/breakiter_current_basic.phpt24
-rw-r--r--ext/intl/tests/breakiter_factories_basic.phpt45
-rw-r--r--ext/intl/tests/breakiter_factories_error.phpt39
-rw-r--r--ext/intl/tests/breakiter_first_basic.phpt21
-rw-r--r--ext/intl/tests/breakiter_first_last_previous_current_error.phpt35
-rw-r--r--ext/intl/tests/breakiter_following_basic.phpt20
-rw-r--r--ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt47
-rw-r--r--ext/intl/tests/breakiter_getAvailableLocales_basic.phpt12
-rw-r--r--ext/intl/tests/breakiter_getAvailableLocales_error.phpt14
-rw-r--r--ext/intl/tests/breakiter_getLocale_basic.phpt17
-rw-r--r--ext/intl/tests/breakiter_getLocale_error.phpt29
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_basic.phpt29
-rw-r--r--ext/intl/tests/breakiter_getText_basic.phpt16
-rw-r--r--ext/intl/tests/breakiter_getText_error.phpt15
-rw-r--r--ext/intl/tests/breakiter_isBoundary_basic.phpt24
-rw-r--r--ext/intl/tests/breakiter_last_basic.phpt19
-rw-r--r--ext/intl/tests/breakiter_next_basic.phpt26
-rw-r--r--ext/intl/tests/breakiter_next_error.phpt23
-rw-r--r--ext/intl/tests/breakiter_preceding_basic.phpt20
-rw-r--r--ext/intl/tests/breakiter_previous_basic.phpt18
-rw-r--r--ext/intl/tests/breakiter_setText_basic.phpt35
-rw-r--r--ext/intl/tests/breakiter_setText_error.phpt40
-rw-r--r--ext/intl/tests/rbbiter___construct_basic.phpt27
-rw-r--r--ext/intl/tests/rbbiter_getBinaryRules_basic.phpt36
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt55
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatus_basic.phpt42
-rw-r--r--ext/intl/tests/rbbiter_getRules_basic.phpt28
-rw-r--r--ext/intl/tests/rbbiter_hashCode_basic.phpt15
31 files changed, 842 insertions, 0 deletions
diff --git a/ext/intl/tests/breakiter___construct.phpt b/ext/intl/tests/breakiter___construct.phpt
new file mode 100644
index 0000000000..a379b19f92
--- /dev/null
+++ b/ext/intl/tests/breakiter___construct.phpt
@@ -0,0 +1,13 @@
+--TEST--
+BreakIterator::__construct() should not be callable
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+new BreakIterator();
+--EXPECTF--
+
+Fatal error: Call to private BreakIterator::__construct() from invalid context in %s on line %d
diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt
new file mode 100644
index 0000000000..c346a56fc9
--- /dev/null
+++ b/ext/intl/tests/breakiter___construct_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+RuleBasedBreakIterator::__construct(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+//missing ; at the end:
+var_dump(new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+'));
+var_dump(new RuleBasedBreakiterator());
+var_dump(new RuleBasedBreakiterator(1,2,3));
+var_dump(new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
+var_dump(new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
+
+--EXPECTF--
+
+Warning: RuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d
+NULL
+
+Warning: RuleBasedBreakIterator::__construct() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: RuleBasedBreakIterator::__construct(): rbbi_create_instance: bad arguments in %s on line %d
+NULL
+
+Warning: RuleBasedBreakIterator::__construct() expects at most 2 parameters, 3 given in %s on line %d
+
+Warning: RuleBasedBreakIterator::__construct(): rbbi_create_instance: bad arguments in %s on line %d
+NULL
+
+Warning: RuleBasedBreakIterator::__construct() expects parameter 2 to be boolean, array given in %s on line %d
+
+Warning: RuleBasedBreakIterator::__construct(): rbbi_create_instance: bad arguments in %s on line %d
+NULL
+
+Warning: RuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to creaete instance from compiled rules in %s on line %d
+NULL
diff --git a/ext/intl/tests/breakiter_clone_basic.phpt b/ext/intl/tests/breakiter_clone_basic.phpt
new file mode 100644
index 0000000000..5c8b243b10
--- /dev/null
+++ b/ext/intl/tests/breakiter_clone_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+BreakIterator: clone handler
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;');
+$bi_clone = clone $bi;
+var_dump(get_class($bi), get_class($bi_clone));
+var_dump($bi == $bi_clone);
+
+$bi->setText('foobar');
+$bi_clone = clone $bi;
+var_dump(get_class($bi), get_class($bi_clone));
+var_dump($bi == $bi_clone);
+
+--EXPECT--
+string(22) "RuleBasedBreakIterator"
+string(22) "RuleBasedBreakIterator"
+bool(true)
+string(22) "RuleBasedBreakIterator"
+string(22) "RuleBasedBreakIterator"
+bool(true)
diff --git a/ext/intl/tests/breakiter_current_basic.phpt b/ext/intl/tests/breakiter_current_basic.phpt
new file mode 100644
index 0000000000..26f1d5f46e
--- /dev/null
+++ b/ext/intl/tests/breakiter_current_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+BreakIterator::current(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+var_dump($bi->current());
+$bi->setText('foo bar trans zoo bee');
+
+var_dump($bi->first());
+var_dump($bi->current());
+var_dump($bi->next());
+var_dump($bi->current());
+?>
+==DONE==
+--EXPECT--
+int(0)
+int(0)
+int(0)
+int(3)
+int(3)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt
new file mode 100644
index 0000000000..30fb312cd5
--- /dev/null
+++ b/ext/intl/tests/breakiter_factories_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+BreakIterator factories: basic tests
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "ja");
+
+$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
+ 'createSentenceInstance', 'createTitleInstance');
+
+$t = 'Frase 1... Frase 2'.
+
+$o1 = $o2 = null;
+foreach ($m as $method) {
+ echo "===== $method =====\n";
+ $o1 = call_user_func(array('Breakiterator', $method), 'ja');
+ var_dump($o1 == $o2);
+ $o2 = call_user_func(array('Breakiterator', $method), NULL);
+ var_dump($o1 == $o2);
+ echo "\n";
+}
+--EXPECT--
+===== createWordInstance =====
+bool(false)
+bool(true)
+
+===== createLineInstance =====
+bool(false)
+bool(true)
+
+===== createCharacterInstance =====
+bool(false)
+bool(true)
+
+===== createSentenceInstance =====
+bool(false)
+bool(true)
+
+===== createTitleInstance =====
+bool(false)
+bool(true)
+
diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt
new file mode 100644
index 0000000000..d172143ad1
--- /dev/null
+++ b/ext/intl/tests/breakiter_factories_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+BreakIterator factory methods: argument errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+var_dump(BreakIterator::createWordInstance(array()));
+var_dump(BreakIterator::createSentenceInstance(NULL, 2));
+var_dump(BreakIterator::createCharacterInstance(NULL, 2));
+var_dump(BreakIterator::createTitleInstance(NULL, 2));
+var_dump(BreakIterator::createLineInstance(NULL, 2));
+
+
+--EXPECTF--
+
+Warning: BreakIterator::createWordInstance() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: BreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
+NULL
+
+Warning: BreakIterator::createSentenceInstance() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
+NULL
+
+Warning: BreakIterator::createCharacterInstance() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
+NULL
+
+Warning: BreakIterator::createTitleInstance() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
+NULL
+
+Warning: BreakIterator::createLineInstance() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
+NULL
diff --git a/ext/intl/tests/breakiter_first_basic.phpt b/ext/intl/tests/breakiter_first_basic.phpt
new file mode 100644
index 0000000000..fb6c2cd9c8
--- /dev/null
+++ b/ext/intl/tests/breakiter_first_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+BreakIterator::first(): basic test
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans');
+
+var_dump($bi->current());
+var_dump($bi->next());
+var_dump($bi->first());
+var_dump($bi->current());
+--EXPECT--
+int(0)
+int(3)
+int(0)
+int(0)
diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
new file mode 100644
index 0000000000..a56228e284
--- /dev/null
+++ b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+BreakIterator::first()/last()/previous()/current(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;');
+$bi->setText("\x80sdfé\x90d888 dfsa9");
+
+var_dump($bi->first(1));
+var_dump($bi->last(1));
+var_dump($bi->previous(1));
+var_dump($bi->current(1));
+
+--EXPECTF--
+
+Warning: BreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::first(): breakiter_first: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::last(): breakiter_last: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::current(): breakiter_current: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt
new file mode 100644
index 0000000000..f460ecbf7a
--- /dev/null
+++ b/ext/intl/tests/breakiter_following_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+BreakIterator::following(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans zoo bee');
+
+var_dump($bi->following(5));
+var_dump($bi->following(50));
+var_dump($bi->following(-1));
+?>
+==DONE==
+--EXPECT--
+int(7)
+int(-1)
+int(0)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
new file mode 100644
index 0000000000..016db6441e
--- /dev/null
+++ b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
@@ -0,0 +1,47 @@
+--TEST--
+BreakIterator::following()/preceding()/isBoundary(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;');
+$bi->setText("\x80sdfé\x90d888 dfsa9");
+
+var_dump($bi->following(1, 2));
+var_dump($bi->following(array()));
+var_dump($bi->preceding(1, 2));
+var_dump($bi->preceding(array()));
+var_dump($bi->isBoundary(1, 2));
+var_dump($bi->isBoundary(array()));
+
+--EXPECTF--
+
+Warning: BreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::following() expects parameter 1 to be long, array given in %s on line %d
+
+Warning: BreakIterator::following(): breakiter_following: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::preceding() expects parameter 1 to be long, array given in %s on line %d
+
+Warning: BreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::isBoundary() expects parameter 1 to be long, array given in %s on line %d
+
+Warning: BreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt b/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt
new file mode 100644
index 0000000000..5cba4c548f
--- /dev/null
+++ b/ext/intl/tests/breakiter_getAvailableLocales_basic.phpt
@@ -0,0 +1,12 @@
+--TEST--
+BreakIterator::getAvailableLocales(): basic test
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+var_dump(count(Breakiterator::getAvailableLocales()) > 150);
+--EXPECT--
+bool(true)
diff --git a/ext/intl/tests/breakiter_getAvailableLocales_error.phpt b/ext/intl/tests/breakiter_getAvailableLocales_error.phpt
new file mode 100644
index 0000000000..4772e8ae2b
--- /dev/null
+++ b/ext/intl/tests/breakiter_getAvailableLocales_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+BreakIterator::getAvailableLocales(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+var_dump(BreakIterator::getAvailableLocales(array()));
+
+--EXPECTF--
+
+Warning: BreakIterator::getAvailableLocales() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::getAvailableLocales(): breakiter_get_available_locales: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_getLocale_basic.phpt b/ext/intl/tests/breakiter_getLocale_basic.phpt
new file mode 100644
index 0000000000..eeed6e802c
--- /dev/null
+++ b/ext/intl/tests/breakiter_getLocale_basic.phpt
@@ -0,0 +1,17 @@
+--TEST--
+BreakIterator::getLocale(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createSentenceInstance('pt');
+
+var_dump($bi->getLocale(0));
+var_dump($bi->getLocale(1));
+?>
+==DONE==
+--EXPECT--
+string(4) "root"
+string(4) "root"
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt
new file mode 100644
index 0000000000..7d822ab563
--- /dev/null
+++ b/ext/intl/tests/breakiter_getLocale_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+BreakIterator::getLocale(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;');
+$bi->setText("\x80sdfé\x90d888 dfsa9");
+
+var_dump($bi->getLocale(1, 2));
+var_dump($bi->getLocale(array()));
+var_dump($bi->getLocale());
+
+--EXPECTF--
+
+Warning: BreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::getLocale() expects parameter 1 to be long, array given in %s on line %d
+
+Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: BreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
new file mode 100644
index 0000000000..5c23bfdfa7
--- /dev/null
+++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
@@ -0,0 +1,29 @@
+--TEST--
+BreakIterator::getPartsIterator(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$pi = $bi->getPartsIterator();
+var_dump(get_class($pi));
+print_r(iterator_to_array($pi));
+
+$bi->setText("foo bar");
+$pi = $bi->getPartsIterator();
+print_r(iterator_to_array($pi));
+?>
+==DONE==
+--EXPECT--
+string(12) "IntlIterator"
+Array
+(
+)
+Array
+(
+ [0] => foo
+ [1] =>
+ [2] => bar
+)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_getText_basic.phpt b/ext/intl/tests/breakiter_getText_basic.phpt
new file mode 100644
index 0000000000..60801ccc45
--- /dev/null
+++ b/ext/intl/tests/breakiter_getText_basic.phpt
@@ -0,0 +1,16 @@
+--TEST--
+BreakIterator::getText(): basic test
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = BreakIterator::createWordInstance('pt');
+var_dump($bi->getText());
+$bi->setText('foo bar');
+var_dump($bi->getText());
+--EXPECTF--
+NULL
+string(7) "foo bar"
diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt
new file mode 100644
index 0000000000..79d152831c
--- /dev/null
+++ b/ext/intl/tests/breakiter_getText_error.phpt
@@ -0,0 +1,15 @@
+--TEST--
+BreakIterator::getText(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}]+;');
+var_dump($bi->getText(array()));
+
+--EXPECTF--
+
+Warning: BreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d
+
+Warning: BreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt
new file mode 100644
index 0000000000..5e8a9f04ec
--- /dev/null
+++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+BreakIterator::isBoundary(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans zoo bee');
+
+var_dump($bi->isBoundary(0));
+var_dump($bi->isBoundary(7));
+var_dump($bi->isBoundary(-1));
+var_dump($bi->isBoundary(1));
+var_dump($bi->isBoundary(50));
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_last_basic.phpt b/ext/intl/tests/breakiter_last_basic.phpt
new file mode 100644
index 0000000000..9e260594d9
--- /dev/null
+++ b/ext/intl/tests/breakiter_last_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+BreakIterator::last(): basic test
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans');
+
+var_dump($bi->current());
+var_dump($bi->last());
+var_dump($bi->current());
+--EXPECTF--
+int(0)
+int(13)
+int(13)
diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt
new file mode 100644
index 0000000000..8e4827e2d4
--- /dev/null
+++ b/ext/intl/tests/breakiter_next_basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+BreakIterator::next(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans zoo bee');
+
+var_dump($bi->first());
+var_dump($bi->next());
+var_dump($bi->next(2));
+var_dump($bi->next(-1));
+var_dump($bi->next(0));
+var_dump($bi->next(NULL));
+?>
+==DONE==
+--EXPECT--
+int(0)
+int(3)
+int(7)
+int(4)
+int(4)
+int(7)
+==DONE==
diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt
new file mode 100644
index 0000000000..08e4aa4c32
--- /dev/null
+++ b/ext/intl/tests/breakiter_next_error.phpt
@@ -0,0 +1,23 @@
+--TEST--
+BreakIterator::next(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}\uFFFD]+;[:number:]+;');
+$bi->setText("\x80sdfé\x90d888 dfsa9");
+
+var_dump($bi->next(1, 2));
+var_dump($bi->next(array()));
+
+--EXPECTF--
+
+Warning: BreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::next() expects parameter 1 to be long, array given in %s on line %d
+
+Warning: BreakIterator::next(): breakiter_next: bad arguments in %s on line %d
+bool(false)
diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt
new file mode 100644
index 0000000000..5a321b6f3c
--- /dev/null
+++ b/ext/intl/tests/breakiter_preceding_basic.phpt
@@ -0,0 +1,20 @@
+--TEST--
+BreakIterator::preceding(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans zoo bee');
+
+var_dump($bi->preceding(5));
+var_dump($bi->preceding(50));
+var_dump($bi->preceding(-1));
+?>
+==DONE==
+--EXPECT--
+int(4)
+int(21)
+int(0)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt
new file mode 100644
index 0000000000..2d0e71656d
--- /dev/null
+++ b/ext/intl/tests/breakiter_previous_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+BreakIterator::previous(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$bi = BreakIterator::createWordInstance('pt');
+$bi->setText('foo bar trans');
+
+var_dump($bi->last());
+var_dump($bi->previous());
+?>
+==DONE==
+--EXPECT--
+int(13)
+int(8)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/breakiter_setText_basic.phpt b/ext/intl/tests/breakiter_setText_basic.phpt
new file mode 100644
index 0000000000..72ea48371b
--- /dev/null
+++ b/ext/intl/tests/breakiter_setText_basic.phpt
@@ -0,0 +1,35 @@
+--TEST--
+BreakIterator::setText(): basic test
+--SKIPIF--
+if (!extension_loaded('intl'))
+ die('skip intl extension not enabled');
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+class A {
+function __tostring() { return 'aaa'; }
+}
+
+$bi = BreakIterator::createWordInstance('pt');
+var_dump($bi->setText('foo bar'));
+var_dump($bi->getText());
+var_dump($bi->setText(1));
+var_dump($bi->getText());
+var_dump($bi->setText(new A));
+var_dump($bi->getText());
+
+/* setText resets the pointer */
+var_dump($bi->next());
+var_dump($bi->setText('foo bar'));
+var_dump($bi->current());
+--EXPECT--
+bool(true)
+string(7) "foo bar"
+bool(true)
+string(1) "1"
+bool(true)
+string(3) "aaa"
+int(3)
+bool(true)
+int(0)
diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt
new file mode 100644
index 0000000000..08d69070a5
--- /dev/null
+++ b/ext/intl/tests/breakiter_setText_error.phpt
@@ -0,0 +1,40 @@
+--TEST--
+BreakIterator::setText(): arg errors
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+
+$bi = new RuleBasedBreakiterator('[\p{Letter}]+;');
+var_dump($bi->setText());
+var_dump($bi->setText(array()));
+var_dump($bi->setText(1,2));
+
+class A {
+function __destruct() { var_dump('destructed'); throw new Exception('e'); }
+function __tostring() { return 'foo'; }
+}
+
+try {
+var_dump($bi->setText(new A));
+} catch (Exception $e) {
+var_dump($e->getMessage());
+}
+
+--EXPECTF--
+
+Warning: BreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d
+
+Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
+bool(false)
+
+Warning: BreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d
+
+Warning: BreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
+bool(false)
+string(10) "destructed"
+string(1) "e"
diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt
new file mode 100644
index 0000000000..567a09fa2d
--- /dev/null
+++ b/ext/intl/tests/rbbiter___construct_basic.phpt
@@ -0,0 +1,27 @@
+--TEST--
+RuleBasedBreakIterator::__construct: basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rules = <<<RULES
+\$LN = [[:letter:] [:number:]];
+\$S = [.;,:];
+
+!!forward;
+\$LN+ {1};
+\$S+ {42};
+!!reverse;
+\$LN+ {1};
+\$S+ {42};
+!!safe_forward;
+!!safe_reverse;
+RULES;
+$rbbi = new RuleBasedBreakIterator($rules);
+var_dump(get_class($rbbi));
+?>
+==DONE==
+--EXPECT--
+string(22) "RuleBasedBreakIterator"
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt
new file mode 100644
index 0000000000..815c711cfc
--- /dev/null
+++ b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+RuleBasedBreakIterator::getBinaryRules(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rules = <<<RULES
+\$LN = [[:letter:] [:number:]];
+\$S = [.;,:];
+
+!!forward;
+\$LN+ {1};
+\$S+ {42};
+!!reverse;
+\$LN+ {1};
+\$S+ {42};
+!!safe_forward;
+!!safe_reverse;
+RULES;
+$rbbi = new RuleBasedBreakIterator($rules);
+$rbbi->setText('sdfkjsdf88á.... ,;');;
+
+$br = $rbbi->getBinaryRules();
+
+$rbbi2 = new RuleBasedBreakIterator($br, true);
+
+var_dump($rbbi->getRules(), $rbbi2->getRules());
+var_dump($rbbi->getRules() == $rbbi2->getRules());
+?>
+==DONE==
+--EXPECT--
+string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
+string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
+bool(true)
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
new file mode 100644
index 0000000000..bbc00e9b48
--- /dev/null
+++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+RuleBasedBreakIterator::getRuleStatusVec(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rules = <<<RULES
+\$LN = [[:letter:] [:number:]];
+\$S = [.;,:];
+
+!!forward;
+\$LN+ {1};
+[^.]+ {4};
+\$S+ {42};
+!!reverse;
+\$LN+ {1};
+[^.]+ {4};
+\$S+ {42};
+!!safe_forward;
+!!safe_reverse;
+RULES;
+$rbbi = new RuleBasedBreakIterator($rules);
+$rbbi->setText('sdfkjsdf88á.... ,;');;
+
+do {
+ var_dump($rbbi->current(), $rbbi->getRuleStatusVec());
+} while ($rbbi->next() != BreakIterator::DONE);
+
+?>
+==DONE==
+--EXPECT--
+int(0)
+array(1) {
+ [0]=>
+ int(0)
+}
+int(12)
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+}
+int(16)
+array(1) {
+ [0]=>
+ int(42)
+}
+int(19)
+array(1) {
+ [0]=>
+ int(4)
+}
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
new file mode 100644
index 0000000000..1bce102489
--- /dev/null
+++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+RuleBasedBreakIterator::getRuleStatus(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rules = <<<RULES
+\$LN = [[:letter:] [:number:]];
+\$S = [.;,:];
+
+!!forward;
+\$LN+ {1};
+\$S+ {42};
+!!reverse;
+\$LN+ {1};
+\$S+ {42};
+!!safe_forward;
+!!safe_reverse;
+RULES;
+$rbbi = new RuleBasedBreakIterator($rules);
+$rbbi->setText('sdfkjsdf88á.... ,;');
+
+do {
+ echo "pos : {$rbbi->current()}\n",
+ "rule status: {$rbbi->getRuleStatus()}\n";
+} while ($rbbi->next() != BreakIterator::DONE);
+
+?>
+==DONE==
+--EXPECT--
+pos : 0
+rule status: 0
+pos : 12
+rule status: 1
+pos : 16
+rule status: 42
+pos : 17
+rule status: 0
+pos : 19
+rule status: 42
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt
new file mode 100644
index 0000000000..7f510484be
--- /dev/null
+++ b/ext/intl/tests/rbbiter_getRules_basic.phpt
@@ -0,0 +1,28 @@
+--TEST--
+RuleBasedBreakIterator::getRules(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rules = <<<RULES
+\$LN = [[:letter:] [:number:]];
+\$S = [.;,:];
+
+!!forward;
+\$LN+ {1};
+\$S+ {42};
+!!reverse;
+\$LN+ {1};
+\$S+ {42};
+!!safe_forward;
+!!safe_reverse;
+RULES;
+$rbbi = new RuleBasedBreakIterator($rules);
+var_dump($rbbi->getRules());
+
+?>
+==DONE==
+--EXPECT--
+string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
+==DONE== \ No newline at end of file
diff --git a/ext/intl/tests/rbbiter_hashCode_basic.phpt b/ext/intl/tests/rbbiter_hashCode_basic.phpt
new file mode 100644
index 0000000000..83155b5c97
--- /dev/null
+++ b/ext/intl/tests/rbbiter_hashCode_basic.phpt
@@ -0,0 +1,15 @@
+--TEST--
+RuleBasedBreakIterator::hashCode(): basic test
+--FILE--
+<?php
+ini_set("intl.error_level", E_WARNING);
+ini_set("intl.default_locale", "pt_PT");
+
+$rbbi = BreakIterator::createWordInstance(NULL);
+var_dump($rbbi->hashCode());
+
+?>
+==DONE==
+--EXPECTF--
+int(%d)
+==DONE== \ No newline at end of file