1--TEST-- 2Check if textdomain() returns the new domain 3--EXTENSIONS-- 4gettext 5--SKIPIF-- 6<?php 7 8 if (!setlocale(LC_ALL, 'en_US.UTF-8')) { 9 die("skip en_US.UTF-8 locale not supported."); 10 } 11?> 12--FILE-- 13<?php 14 15chdir(__DIR__); 16setlocale(LC_ALL, 'en_US.UTF-8'); 17bindtextdomain ("messages", "./locale"); 18echo textdomain('test'), "\n"; 19echo textdomain(null), "\n"; 20echo textdomain('foo'), "\n"; 21 22try { 23 textdomain('0'); 24} catch (\ValueError $e) { 25 echo $e->getMessage() . PHP_EOL; 26} 27 28try { 29 textdomain(''); 30} catch (\ValueError $e) { 31 echo $e->getMessage(); 32} 33?> 34--EXPECT-- 35test 36test 37foo 38textdomain(): Argument #1 ($domain) cannot be zero 39textdomain(): Argument #1 ($domain) must not be empty 40--CREDITS-- 41Christian Weiske, cweiske@php.net 42PHP Testfest Berlin 2009-05-09 43