/** * @group Core */ public function testGetLocalizedLongString() { $this->loadEnglishTranslation(); $week = new Week(Date::factory('2024-10-09')); $shouldBe = 'Week 7 October - 13 October 2024'; $this->assertEquals($shouldBe, $week->getLocalizedLongString()); }
/** * @group Core * @dataProvider getLocalizedLongStrings */ public function testGetLocalizedLongString($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->getLocalizedLongString()); // a week ending in another month $week = new Week(Date::factory('2024-12-01')); $this->assertEquals($shouldBe[1], $week->getLocalizedLongString()); // a week ending in another year $week = new Week(Date::factory('2024-12-31')); $this->assertEquals($shouldBe[2], $week->getLocalizedLongString()); }