/** * test monthly * @group Core * @group TablePartitioning */ public function testMonthlyPartition() { $tableName = 'archive_numeric'; $p = new Piwik_TablePartitioning_Monthly($tableName); $timestamp = strtotime("10 September 2000"); $suffixShouldBe = "_2000_09"; $prefixTables = Piwik_Config::getInstance()->database['tables_prefix']; $tablename = $prefixTables . $tableName . $suffixShouldBe; $p->setTimestamp($timestamp); $allTablesInstalled = Piwik::getTablesInstalled($forceReload = true); $this->assertContains($tablename, $allTablesInstalled); $this->assertEquals($tablename, $p->getTableName()); $this->assertEquals($tablename, (string) $p->__toString()); }
function test_monthlyPartition() { $tableName = 'archive_numeric'; $p = new Piwik_TablePartitioning_Monthly($tableName); $timestamp = strtotime("10 September 2000"); $suffixShouldBe = "_2000_09"; $config = Zend_Registry::get('config'); $prefixTables = $config->database->tables_prefix; $tablename = $prefixTables . $tableName . $suffixShouldBe; $p->setTimestamp($timestamp); $allTablesInstalled = Piwik::getTablesInstalled($forceReload = true); $this->assertTrue(in_array($tablename, $allTablesInstalled)); $this->assertTrue($tablename, $p->getTableName()); $this->assertEqual($tablename, (string) $p); }
/** * Utility function which creates a TablePartitioning instance for the blob * archive data of a given period. * * @param $period The time period of the archive data. * @return Piwik_TablePartitioning_Monthly */ public static function makeBlobArchiveTable($period) { $result = new Piwik_TablePartitioning_Monthly('archive_blob'); $result->setTimestamp($period->getDateStart()->getTimestamp()); return $result; }