From: Antony Dovgal Date: Mon, 16 Jul 2007 10:59:17 +0000 (+0000) Subject: MFH: split test X-Git-Tag: php-5.2.4RC1~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2399b208db3f471461207d15b0e83c1995d2757c;p=php MFH: split test --- diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt new file mode 100644 index 0000000000..f880e9481e --- /dev/null +++ b/ext/standard/tests/strings/substr_count_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test substr_count() function (basic) +--FILE-- + +--EXPECTF-- +***Testing basic operations *** +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(10) +Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt new file mode 100644 index 0000000000..01d4caa6ad --- /dev/null +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test substr_count() function (error conditions) +--FILE-- + size of the string */ +var_dump(substr_count($str, "t", 25)); + +/* Using offset and length to go beyond the size of the string: + Warning message expected, as length+offset > length of string */ +var_dump( substr_count($str, "i", 5, 15) ); + +/* length as Null */ +var_dump( substr_count($str, "t", "", "") ); +var_dump( substr_count($str, "i", NULL, NULL) ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: Wrong parameter count for substr_count() in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: Wrong parameter count for substr_count() in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Length should be greater than 0. in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Length should be greater than 0. in %s on line %d +bool(false) +Done diff --git a/ext/standard/tests/strings/substr_count.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt similarity index 51% rename from ext/standard/tests/strings/substr_count.phpt rename to ext/standard/tests/strings/substr_count_variation_001.phpt index f15f425081..cb6fc6bd3e 100644 --- a/ext/standard/tests/strings/substr_count.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -1,25 +1,7 @@ --TEST-- -Test substr_count() function +Test substr_count() function (variation - 1) --FILE-- size of the string */ -var_dump(substr_count($str, "t", 25)); - -/* Using offset and length to go beyond the size of the string: - Warning message expected, as length+offset > length of string */ -var_dump( substr_count($str, "i", 5, 15) ); - -/* length as Null */ -var_dump( substr_count($str, "t", "", "") ); -var_dump( substr_count($str, "i", NULL, NULL) ); - echo "Done\n"; ?> --EXPECTF-- -***Testing basic operations *** -bool(false) -bool(false) -int(0) -int(0) -int(0) -int(100) -int(200) -int(160) -int(10) - *** Testing possible variations *** -- 3rd or 4th arg as string -- int(1) @@ -135,27 +84,4 @@ int(16) int(0) int(0) int(0) - -*** Testing error conditions *** - -Warning: Wrong parameter count for substr_count() in %s on line %d -NULL - -Warning: Wrong parameter count for substr_count() in %s on line %d -NULL - -Warning: substr_count(): Offset should be greater than or equal to 0. in %s on line %d -bool(false) - -Warning: substr_count(): Offset value 25 exceeds string length. in %s on line %d -bool(false) - -Warning: substr_count(): Offset value 5 exceeds string length. in %s on line %d -bool(false) - -Warning: substr_count(): Length should be greater than 0. in %s on line %d -bool(false) - -Warning: substr_count(): Length should be greater than 0. in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_002.phpt b/ext/standard/tests/strings/substr_count_variation_002.phpt new file mode 100644 index 0000000000..f8b62bd837 --- /dev/null +++ b/ext/standard/tests/strings/substr_count_variation_002.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test substr_count() function (variation - 2) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done