Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php')
-rw-r--r--tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php202
1 files changed, 101 insertions, 101 deletions
diff --git a/tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php b/tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php
index 03082336bf..2780534248 100644
--- a/tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php
+++ b/tests/PHPUnit/Core/DataTable/Renderer/CSVTest.php
@@ -23,30 +23,30 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableTest()
{
$dataTable = new Piwik_DataTable();
-
- $arraySubTableForRow2 = array (
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'sub1', 'count' => 1, 'bool' => false) ),
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'sub2', 'count' => 2, 'bool' => true) ),
+
+ $arraySubTableForRow2 = array(
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'sub1', 'count' => 1, 'bool' => false)),
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'sub2', 'count' => 2, 'bool' => true)),
);
$subDataTableForRow2 = new Piwik_DataTable();
$subDataTableForRow2->addRowsFromArray($arraySubTableForRow2);
- $array = array (
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google©', 'bool' => false, 'goals' => array('idgoal=1' => array('revenue'=> 5.5, 'nb_conversions' => 10)), 'nb_uniq_visitors' => 11, 'nb_visits' => 11, 'nb_actions' => 17, 'max_actions' => '5', 'sum_visit_length' => 517, 'bounce_count' => 9),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com/display"and,properly', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
- ),
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'bool' => true, 'nb_visits' => 151, 'nb_actions' => 147, 'max_actions' => '50', 'sum_visit_length' => 517, 'bounce_count' => 90),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
- Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subDataTableForRow2,
- )
- );
+ $array = array(
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Google©', 'bool' => false, 'goals' => array('idgoal=1' => array('revenue' => 5.5, 'nb_conversions' => 10)), 'nb_uniq_visitors' => 11, 'nb_visits' => 11, 'nb_actions' => 17, 'max_actions' => '5', 'sum_visit_length' => 517, 'bounce_count' => 9),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com/display"and,properly', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
+ ),
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'bool' => true, 'nb_visits' => 151, 'nb_actions' => 147, 'max_actions' => '50', 'sum_visit_length' => 517, 'bounce_count' => 90),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
+ Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subDataTableForRow2,
+ )
+ );
$dataTable->addRowsFromArray($array);
return $dataTable;
}
protected function _getDataTableSimpleTest()
{
- $array = array ( 'max_actions' => 14.0, 'nb_uniq_visitors' => 57.0, 'nb_visits' => 66.0, 'nb_actions' => 151.0, 'sum_visit_length' => 5118.0, 'bounce_count' => 44.0, );
+ $array = array('max_actions' => 14.0, 'nb_uniq_visitors' => 57.0, 'nb_visits' => 66.0, 'nb_actions' => 151.0, 'sum_visit_length' => 5118.0, 'bounce_count' => 44.0,);
$table = new Piwik_DataTable_Simple;
$table->addRowsFromArray($array);
@@ -55,7 +55,7 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableSimpleOneRowTest()
{
- $array = array ( 'nb_visits' => 14.0 );
+ $array = array('nb_visits' => 14.0);
$table = new Piwik_DataTable_Simple;
$table->addRowsFromArray($array);
@@ -70,7 +70,7 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableSimpleOneZeroRowTest()
{
- $array = array ( 'nb_visits' => 0 );
+ $array = array('nb_visits' => 0);
$table = new Piwik_DataTable_Simple;
$table->addRowsFromArray($array);
return $table;
@@ -78,7 +78,7 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableSimpleOneFalseRowTest()
{
- $array = array ( 'is_excluded' => false );
+ $array = array('is_excluded' => false);
$table = new Piwik_DataTable_Simple;
$table->addRowsFromArray($array);
return $table;
@@ -94,13 +94,13 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
public function testCSVTest1()
{
$dataTable = $this->_getDataTableTest();
-
+
$render = new Piwik_DataTable_Renderer_Csv();
$render->setTable($dataTable);
$render->convertToUnicode = false;
$expected = "label,bool,goals_idgoal=1_revenue,goals_idgoal=1_nb_conversions,nb_uniq_visitors,nb_visits,nb_actions,max_actions,sum_visit_length,bounce_count,metadata_url,metadata_logo\n" .
- "Google©,0,5.5,10,11,11,17,5,517,9,\"http://www.google.com/display\"\"and,properly\",./plugins/Referers/images/searchEngines/www.google.com.png\n" .
- "Yahoo!,1,,,15,151,147,50,517,90,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png";
+ "Google©,0,5.5,10,11,11,17,5,517,9,\"http://www.google.com/display\"\"and,properly\",./plugins/Referers/images/searchEngines/www.google.com.png\n" .
+ "Yahoo!,1,,,15,151,147,50,517,90,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png";
$rendered = $render->render();
$this->assertEquals($expected, $rendered);
@@ -198,26 +198,26 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableArrayTest()
{
- $array1 = array (
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google', 'nb_uniq_visitors' => 11, 'nb_visits' => 11, ),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
- ),
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'nb_visits' => 151, ),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
- )
- );
+ $array1 = array(
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Google', 'nb_uniq_visitors' => 11, 'nb_visits' => 11,),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png'),
+ ),
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Yahoo!', 'nb_uniq_visitors' => 15, 'nb_visits' => 151,),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png'),
+ )
+ );
$table1 = new Piwik_DataTable();
$table1->addRowsFromArray($array1);
- $array2 = array (
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Google1©', 'nb_uniq_visitors' => 110, 'nb_visits' => 110,),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com1', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png1'),
- ),
- array ( Piwik_DataTable_Row::COLUMNS => array( 'label' => 'Yahoo!1', 'nb_uniq_visitors' => 150, 'nb_visits' => 1510,),
- Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com1', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png1'),
- )
- );
+ $array2 = array(
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Google1©', 'nb_uniq_visitors' => 110, 'nb_visits' => 110,),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.google.com1', 'logo' => './plugins/Referers/images/searchEngines/www.google.com.png1'),
+ ),
+ array(Piwik_DataTable_Row::COLUMNS => array('label' => 'Yahoo!1', 'nb_uniq_visitors' => 150, 'nb_visits' => 1510,),
+ Piwik_DataTable_Row::METADATA => array('url' => 'http://www.yahoo.com1', 'logo' => './plugins/Referers/images/searchEngines/www.yahoo.com.png1'),
+ )
+ );
$table2 = new Piwik_DataTable();
$table2->addRowsFromArray($array2);
@@ -235,11 +235,11 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableSimpleArrayTest()
{
- $array1 = array ( 'max_actions' => 14.0, 'nb_uniq_visitors' => 57.0, );
+ $array1 = array('max_actions' => 14.0, 'nb_uniq_visitors' => 57.0,);
$table1 = new Piwik_DataTable_Simple;
$table1->addRowsFromArray($array1);
- $array2 = array ( 'max_actions' => 140.0, 'nb_uniq_visitors' => 570.0, );
+ $array2 = array('max_actions' => 140.0, 'nb_uniq_visitors' => 570.0,);
$table2 = new Piwik_DataTable_Simple;
$table2->addRowsFromArray($array2);
@@ -256,10 +256,10 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
protected function _getDataTableSimpleOneRowArrayTest()
{
- $array1 = array ( 'nb_visits' => 14.0 );
+ $array1 = array('nb_visits' => 14.0);
$table1 = new Piwik_DataTable_Simple;
$table1->addRowsFromArray($array1);
- $array2 = array ( 'nb_visits' => 15.0 );
+ $array2 = array('nb_visits' => 15.0);
$table2 = new Piwik_DataTable_Simple;
$table2->addRowsFromArray($array2);
@@ -311,10 +311,10 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
$render->setTable($dataTable);
$render->convertToUnicode = false;
$expected = "testKey,label,nb_uniq_visitors,nb_visits,metadata_url,metadata_logo\n" .
- "date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png\n" .
- "date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png\n" .
- "date2,Google1©,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1\n" .
- "date2,Yahoo!1,150,1510,http://www.yahoo.com1,./plugins/Referers/images/searchEngines/www.yahoo.com.png1";
+ "date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png\n" .
+ "date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png\n" .
+ "date2,Google1©,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1\n" .
+ "date2,Yahoo!1,150,1510,http://www.yahoo.com1,./plugins/Referers/images/searchEngines/www.yahoo.com.png1";
$rendered = $render->render();
$this->assertEquals($expected, $rendered);
@@ -368,13 +368,13 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
$render->setTable($dataTable);
$render->convertToUnicode = false;
$expected = "parentArrayKey,testKey,label,nb_uniq_visitors,nb_visits,metadata_url,metadata_logo\n" .
- "idSite,date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png\n" .
- "idSite,date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png\n" .
- "idSite,date2,Google1©,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1\n" .
- "idSite,date2,Yahoo!1,150,1510,http://www.yahoo.com1,./plugins/Referers/images/searchEngines/www.yahoo.com.png1";
+ "idSite,date1,Google,11,11,http://www.google.com,./plugins/Referers/images/searchEngines/www.google.com.png\n" .
+ "idSite,date1,Yahoo!,15,151,http://www.yahoo.com,./plugins/Referers/images/searchEngines/www.yahoo.com.png\n" .
+ "idSite,date2,Google1©,110,110,http://www.google.com1,./plugins/Referers/images/searchEngines/www.google.com.png1\n" .
+ "idSite,date2,Yahoo!1,150,1510,http://www.yahoo.com1,./plugins/Referers/images/searchEngines/www.yahoo.com.png1";
$rendered = $render->render();
- $this->assertEquals( $expected,$rendered);
+ $this->assertEquals($expected, $rendered);
}
/**
@@ -411,79 +411,79 @@ class DataTable_Renderer_CSVTest extends PHPUnit_Framework_TestCase
$rendered = $render->render();
$this->assertEquals($expected, $rendered);
}
-
- /**
- * @group Core
- * @group DataTable
- * @group DataTable_Renderer
- * @group DataTable_Renderer_XML
- */
- public function testRenderArray1()
- {
- $data = array();
-
+
+ /**
+ * @group Core
+ * @group DataTable
+ * @group DataTable_Renderer
+ * @group DataTable_Renderer_XML
+ */
+ public function testRenderArray1()
+ {
+ $data = array();
+
$render = new Piwik_DataTable_Renderer_Csv();
$render->setTable($data);
$render->convertToUnicode = false;
$expected = 'No data available';
-
+
$this->assertEquals($expected, $render->render());
- }
-
- /**
- * @group Core
- * @group DataTable
- * @group DataTable_Renderer
- * @group DataTable_Renderer_XML
- */
- public function testRenderArray2()
- {
- $data = array('a', 'b', 'c');
-
+ }
+
+ /**
+ * @group Core
+ * @group DataTable
+ * @group DataTable_Renderer
+ * @group DataTable_Renderer_XML
+ */
+ public function testRenderArray2()
+ {
+ $data = array('a', 'b', 'c');
+
$render = new Piwik_DataTable_Renderer_Csv();
$render->setTable($data);
$render->convertToUnicode = false;
$expected = 'a
b
c';
-
+
$this->assertEquals($expected, $render->render());
- }
-
- /**
- * @group Core
- * @group DataTable
- * @group DataTable_Renderer
- * @group DataTable_Renderer_XML
- */
- public function testRenderArray3()
- {
- $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g');
-
+ }
+
+ /**
+ * @group Core
+ * @group DataTable
+ * @group DataTable_Renderer
+ * @group DataTable_Renderer_XML
+ */
+ public function testRenderArray3()
+ {
+ $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g');
+
$render = new Piwik_DataTable_Renderer_Csv();
$render->setTable($data);
$render->convertToUnicode = false;
$expected = 'a,c,e,5
b,d,f,g';
-
+
$this->assertEquals($expected, $render->render());
- }
-
- /**
- * @group Core
- * @group DataTable
- * @group DataTable_Renderer
- * @group DataTable_Renderer_XML
- */
- public function testRenderArray4()
- {
- $data = array('a' => 'b');
-
+ }
+
+ /**
+ * @group Core
+ * @group DataTable
+ * @group DataTable_Renderer
+ * @group DataTable_Renderer_XML
+ */
+ public function testRenderArray4()
+ {
+ $data = array('a' => 'b');
+
$render = new Piwik_DataTable_Renderer_Csv();
$render->setTable($data);
$render->convertToUnicode = false;
$expected = 'b';
-
+
$this->assertEquals($expected, $render->render());
- }
+ }
}