/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * 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
__('bar')

<?php __('foo') ?>

<?php __('I\'m "happy"') ?>
<?php __("I'm very \"happy\"") ?>
<?php __("I\\'m so \"happy\"") ?>
EOF;
Пример #2
0
 /**
  * Extracts i18n strings from PHP files.
  *
  * @param string $dir The PHP full path name
  */
 protected function extractFromPhpFiles($dir)
 {
     $phpExtractor = new sfI18nPhpExtractor();
     $files = sfFinder::type('file')->name('*.php');
     $messages = array();
     foreach ($files->in($dir) as $file) {
         $messages = array_merge($messages, $phpExtractor->extract(file_get_contents($file)));
     }
     $this->updateMessages($messages);
 }