/** * Test that the formatting rules are parsed correctly. * If the bundle has a parent, also test that the values between the two are merged correctly. */ public function testGetFormatPatterns() { $parent = $this->parent->getFormatPatterns(); $formats = $this->formats->getFormatPatterns(); $inflections = $this->inflections->getFormatPatterns(); $validations = $this->validations->getFormatPatterns(); $parentFormat = ['date' => 'ex', 'time' => 'ex', 'datetime' => 'ex', 'pluralForms' => 2, 'pluralRule' => function () { }]; // Parent $this->assertTrue(is_array($parent)); $this->assertEquals($parentFormat, $parent); // Formats $this->assertTrue(is_array($formats)); $this->assertEquals(['date' => 'ex_FM', 'time' => 'ex', 'datetime' => 'ex', 'pluralForms' => 3, 'pluralRule' => function () { }], $formats); // Inflections $this->assertTrue(is_array($inflections)); $this->assertEquals($parentFormat, $inflections); // Validations $this->assertTrue(is_array($validations)); $this->assertEquals($parentFormat, $validations); // By key $this->assertEquals('ex_FM', $this->formats->getFormatPatterns('date')); $this->assertEquals('ex', $this->formats->getFormatPatterns('time')); $this->assertEquals('ex', $this->formats->getFormatPatterns('datetime')); $this->assertEquals(3, $this->formats->getFormatPatterns('pluralForms')); $this->assertEquals(null, $this->formats->getFormatPatterns('fakeKey')); }