Beispiel #1
0
 /**
  * @test
  */
 public function modelIsReturnedCorrectlyForSingleFile()
 {
     file_put_contents('vfs://Foo/Bar.xml', '');
     $result = $this->repository->getModel('Bar');
     $this->assertAttributeContains('vfs://Foo/Bar.xml', 'sourcePaths', $result);
     $result = $this->repository->getModel('NoSuchFile');
     $this->assertEquals(FALSE, $result);
 }
Beispiel #2
0
 /**
  * Generates an internal representation of plural rules which can be found
  * in plurals.xml CLDR file.
  *
  * The properties $rulesets and $rulesetsIndices should be empty before
  * running this method.
  *
  * @return void
  * @see \TYPO3\FLOW3\I18n\Cldr\Reader\PluralsReader::$rulesets
  */
 protected function generateRulesets()
 {
     $model = $this->cldrRepository->getModel('supplemental/plurals');
     $pluralRulesSet = $model->getRawArray('plurals');
     $index = 0;
     foreach ($pluralRulesSet as $pluralRulesNodeString => $pluralRules) {
         $localeLanguages = $model->getAttributeValue($pluralRulesNodeString, 'locales');
         foreach (explode(' ', $localeLanguages) as $localeLanguage) {
             $this->rulesetsIndices[$localeLanguage] = $index;
         }
         if (is_array($pluralRules)) {
             $ruleset = array();
             foreach ($pluralRules as $pluralRuleNodeString => $pluralRule) {
                 $pluralForm = $model->getAttributeValue($pluralRuleNodeString, 'count');
                 $ruleset[$pluralForm] = $this->parseRule($pluralRule);
             }
             foreach (explode(' ', $localeLanguages) as $localeLanguage) {
                 $this->rulesets[$localeLanguage][$index] = $ruleset;
             }
         }
         ++$index;
     }
 }