/** * @group Core * @group Period * @group Period_Year */ public function testGetPrettyString() { Piwik_Translate::getInstance()->loadEnglishTranslation(); $year = new Piwik_Period_Year(Piwik_Date::factory('2024-10-09')); $shouldBe = '2024'; $this->assertEquals($shouldBe, $year->getPrettyString()); }
/** * @group Core * @group Period */ public function testGetLabel() { $period = new Piwik_Period_Day(Piwik_Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); $period = new Piwik_Period_Week(Piwik_Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); $period = new Piwik_Period_Month(Piwik_Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); $period = new Piwik_Period_Year(Piwik_Date::today()); $label = $period->getLabel(); $this->assertInternalType('string', $label); $this->assertNotEmpty($label); }
/** * @group Core * @group Period * @group Period_Range */ public function testRangeYearLast1() { $range = new Piwik_Period_Range('year', 'last1'); $currentYear = new Piwik_Period_Year(Piwik_Date::today()); $this->assertEquals(1, $range->getNumberOfSubperiods()); $this->assertEquals(array($currentYear->toString()), $range->toString()); }
function test_range_year_last1() { $range = new Piwik_Period_Range('year', 'last1'); $currentYear = new Piwik_Period_Year(Piwik_Date::today()); $this->assertEqual($range->getNumberOfSubperiods(), 1); $this->assertEqual($range->toString(), array($currentYear->toString())); }