Skip to content
Extraits de code Groupes Projets
Valider bcf12baf rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

fix broken tests

parent be9dc8ec
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -1322,14 +1322,14 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess ...@@ -1322,14 +1322,14 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess
if (is_array($rows[self::ID_SUMMARY_ROW])) { if (is_array($rows[self::ID_SUMMARY_ROW])) {
$this->summaryRow = new Row($rows[self::ID_SUMMARY_ROW]); $this->summaryRow = new Row($rows[self::ID_SUMMARY_ROW]);
} elseif (isset($rows[self::ID_SUMMARY_ROW]->c)) { } elseif (isset($rows[self::ID_SUMMARY_ROW]->c)) {
$this->summaryRow = new Row($rows[self::ID_SUMMARY_ROW]->c); $this->summaryRow = new Row($rows[self::ID_SUMMARY_ROW]->c); // Pre Piwik 2.13
} }
unset($rows[self::ID_SUMMARY_ROW]); unset($rows[self::ID_SUMMARY_ROW]);
} }
foreach ($rows as $id => $row) { foreach ($rows as $id => $row) {
if (isset($row->c)) { if (isset($row->c)) {
$this->addRow(new Row($row->c)); $this->addRow(new Row($row->c)); // Pre Piwik 2.13
} else { } else {
$this->addRow(new Row($row)); $this->addRow(new Row($row));
} }
......
...@@ -182,15 +182,16 @@ class OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTest extends SystemTestCa ...@@ -182,15 +182,16 @@ class OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTest extends SystemTestCa
'archive_blob_2011_01' => 3, 'archive_blob_2011_01' => 3,
); );
$chunk = new Chunk(); $chunk = new Chunk();
$chunkName = $chunk->getRecordNameForTableId('Actions_actions_url', 0);
foreach ($tests as $table => $expectedNumSubtables) { foreach ($tests as $table => $expectedNumSubtables) {
$chunkAppendix = $chunk->getRecordNameForTableId(0); $sql = "SELECT value FROM " . Common::prefixTable($table) . " WHERE period = " . Piwik::$idPeriods['range'] . " and `name` ='$chunkName'";
$sql = "SELECT value FROM " . Common::prefixTable($table) . " WHERE period = " . Piwik::$idPeriods['range'] . " and `name` ='Actions_actions_url_$chunkAppendix'";
$blob = Db::get()->fetchOne($sql); $blob = Db::get()->fetchOne($sql);
$blob = gzuncompress($blob); $blob = gzuncompress($blob);
$blob = unserialize($blob); $blob = unserialize($blob);
$countSubtables = count($blob); $countSubtables = count($blob);
$this->assertEquals($expectedNumSubtables, $countSubtables, "Actions_actions_url_subtables in $table expected to contain $expectedNumSubtables subtables, got $countSubtables"); $this->assertEquals($expectedNumSubtables, $countSubtables, "Actions_actions_url_chunk_0_99 in $table expected to contain $expectedNumSubtables subtables, got $countSubtables");
} }
} }
......
...@@ -117,24 +117,23 @@ class TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest extends SystemTest ...@@ -117,24 +117,23 @@ class TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest extends SystemTest
public function test_checkArchiveRecords_shouldMergeSubtablesIntoOneRow() public function test_checkArchiveRecords_shouldMergeSubtablesIntoOneRow()
{ {
$chunk = new Chunk(); $chunk = new Chunk();
$chunkBlobId = $chunk->getRecordNameForTableId(0);
$tests = array( $tests = array(
'archive_blob_2010_01' => array( 'archive_blob_2010_01' => array(
'CustomVariables_valueByName_' . $chunkBlobId => 6, $chunk->getRecordNameForTableId('CustomVariables_valueByName', 0) => 6,
'Referrers_keywordBySearchEngine_' . $chunkBlobId => 1, $chunk->getRecordNameForTableId('Referrers_keywordBySearchEngine', 0) => 1,
'Referrers_searchEngineByKeyword_' . $chunkBlobId => 1, $chunk->getRecordNameForTableId('Referrers_searchEngineByKeyword', 0) => 1
), ),
'archive_blob_2009_12' => array( 'archive_blob_2009_12' => array(
'CustomVariables_valueByName_' . $chunkBlobId => 6, $chunk->getRecordNameForTableId('CustomVariables_valueByName', 0) => 6,
'Referrers_keywordBySearchEngine_' . $chunkBlobId => 1, $chunk->getRecordNameForTableId('Referrers_keywordBySearchEngine', 0) => 1,
'Referrers_searchEngineByKeyword_' . $chunkBlobId => 1, $chunk->getRecordNameForTableId('Referrers_searchEngineByKeyword', 0) => 1,
) )
); );
$numTests = 0; $numTests = 0;
foreach ($tests as $table => $expectedSubtables) { foreach ($tests as $table => $expectedSubtables) {
foreach ($expectedSubtables as $name => $expectedNumSubtables) { foreach ($expectedSubtables as $name => $expectedNumSubtables) {
$sql = "SELECT `value` FROM " . Common::prefixTable($table) . " WHERE `name` ='$name'"; $sql = "SELECT `value` FROM " . Common::prefixTable($table) . " WHERE `name` ='$name'";
$blobs = Db::get()->fetchAll($sql); $blobs = Db::get()->fetchAll($sql);
foreach ($blobs as $blob) { foreach ($blobs as $blob) {
......
...@@ -40,7 +40,7 @@ class ChunkTest extends UnitTestCase ...@@ -40,7 +40,7 @@ class ChunkTest extends UnitTestCase
$this->assertEquals($this->recordName . '_chunk_' . $expectedChunk, $this->chunk->getRecordNameForTableId($this->recordName, $tableId)); $this->assertEquals($this->recordName . '_chunk_' . $expectedChunk, $this->chunk->getRecordNameForTableId($this->recordName, $tableId));
} }
public function getRecordNameForTableId() public function getRecordNameForTableIdDataProvider()
{ {
return array( return array(
array($expectedChunk = '0_99', $tableId = 0), array($expectedChunk = '0_99', $tableId = 0),
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter