Esempio n. 1
0
 /**
  * Test that the inflection rules are parsed correctly.
  * If the bundle has a parent, also test that the values between the two are merged correctly.
  */
 public function testGetInflectionRules()
 {
     $parent = $this->parent->getInflectionRules();
     $formats = $this->formats->getInflectionRules();
     $inflections = $this->inflections->getInflectionRules();
     $validations = $this->validations->getInflectionRules();
     $parentInflections = ['irregular' => ['ex' => 'irregular'], 'uninflected' => ['ex'], 'plural' => ['ex' => 'plural'], 'singular' => ['ex' => 'singular']];
     // Parent
     $this->assertTrue(is_array($parent));
     $this->assertEquals($parentInflections, $parent);
     // Formats
     $this->assertTrue(is_array($formats));
     $this->assertEquals($parentInflections, $formats);
     // Inflections
     $this->assertTrue(is_array($inflections));
     $this->assertEquals(['irregular' => ['ex_IN' => 'irregular'], 'uninflected' => ['ex'], 'plural' => ['ex_IN' => 'plural'], 'singular' => ['ex_IN' => 'singular']], $inflections);
     // Validations
     $this->assertTrue(is_array($validations));
     $this->assertEquals($parentInflections, $validations);
     // By key
     $this->assertEquals(['ex_IN' => 'irregular'], $this->inflections->getInflectionRules('irregular'));
     $this->assertEquals(['ex_IN' => 'plural'], $this->inflections->getInflectionRules('plural'));
     $this->assertEquals(['ex_IN' => 'singular'], $this->inflections->getInflectionRules('singular'));
     $this->assertEquals(['ex'], $this->inflections->getInflectionRules('uninflected'));
     $this->assertEquals(null, $this->inflections->getInflectionRules('fakeKey'));
 }