* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once(dirname(__FILE__).'/../../../bootstrap/unit.php'); $t = new lime_test(7); // __construct() $t->diag('__construct()'); $e = new sfI18nPhpExtractor(); $t->ok($e instanceof sfI18nExtractorInterface, 'sfI18nPhpExtractor implements the sfI18nExtractorInterface interface'); // ->extract(); $t->diag('->extract()'); $content = << EOF; $t->is($e->extract($content), array('foo', 'I\'m "happy"', 'I\'m very "happy"', 'I\\\'m so "happy"'), '->extract() extracts strings from PHP files'); $content = << EOF; $t->is($e->extract($content), array('foo'), '->extract() takes into account the format_number_choice() helper'); $content = <<getContext()->getI18N()->__('foo') ?> EOF; $t->is($e->extract($content), array('foo'), '->extract() takes into account calls in an action file'); $content = << foo)); ?> EOF; $t->is($e->extract($content), array('foo', 'bar', 'foobar', 'foo %a% bar'), '->extract() extracts strings from \'\' and "" quoted strings'); $content = << EOF; $t->is($e->extract($content), array('foo', 'bar'), '->extract() does not care if you add some whitespaces'); $content = <<is(fix_linebreaks($e->extract($content)), array("foo\n", "bar\n"), '->extract() extracts strings from HEREDOC quoted strings');