/** * @group Core */ public function testGetLocalizedShortString() { $this->loadEnglishTranslation(); $week = new Week(Date::factory('2024-10-09')); $shouldBe = '7 Oct - 13 Oct 24'; $this->assertEquals($shouldBe, $week->getLocalizedShortString()); }
/** * @group Core * @dataProvider getLocalizedShortStrings */ public function testGetLocalizedShortString($language, $shouldBe) { StaticContainer::get('Piwik\\Translation\\Translator')->setCurrentLanguage($language); // a week within a month $week = new Week(Date::factory('2024-10-09')); $this->assertEquals($shouldBe[0], $week->getLocalizedShortString()); // a week ending in another month $week = new Week(Date::factory('2024-12-01')); $this->assertEquals($shouldBe[1], $week->getLocalizedShortString()); // a week ending in another year $week = new Week(Date::factory('2024-12-31')); $this->assertEquals($shouldBe[2], $week->getLocalizedShortString()); }