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

fixing some more bugs and tests, not sure yet how to fix the missing metrics properly

parent 9cd2d461
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -68,7 +68,11 @@ class DataTablePostProcessor ...@@ -68,7 +68,11 @@ class DataTablePostProcessor
$this->apiMethod = $apiMethod; $this->apiMethod = $apiMethod;
$this->request = $request; $this->request = $request;
$this->report = Report::factory($apiModule, $apiMethod); foreach (Report::getAllReports() as $report) {
if ($apiMethod === $report->getAction() && $apiModule === $report->getModule()) {
$this->report = $report;
}
}
$this->apiInconsistencies = new Inconsistencies(); $this->apiInconsistencies = new Inconsistencies();
$this->formatter = new Formatter(); $this->formatter = new Formatter();
} }
......
...@@ -14,6 +14,7 @@ use Piwik\Piwik; ...@@ -14,6 +14,7 @@ use Piwik\Piwik;
use Piwik\Plugin\Report; use Piwik\Plugin\Report;
use Piwik\Site; use Piwik\Site;
use Piwik\ViewDataTable\Factory as ViewDataTableFactory; use Piwik\ViewDataTable\Factory as ViewDataTableFactory;
use Piwik\WidgetsList;
abstract class Base extends Report abstract class Base extends Report
{ {
...@@ -99,4 +100,15 @@ abstract class Base extends Report ...@@ -99,4 +100,15 @@ abstract class Base extends Report
return $rendered; return $rendered;
} }
public function configureWidget(WidgetsList $widget)
{
if ($this->widgetTitle) {
$params = array();
if (!empty($this->widgetParams) && is_array($this->widgetParams)) {
$params = $this->widgetParams;
}
$widget->add($this->category, $this->widgetTitle, 'Ecommerce', $this->action, $params);
}
}
} }
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Ecommerce;
use Piwik\Common;
use Piwik\Site;
use Piwik\Piwik;
class Widgets extends \Piwik\Plugin\Widgets
{
protected $category = 'Goals_Ecommerce';
protected function init()
{
$idSite = $this->getIdSite();
$site = new Site($idSite);
if ($site->isEcommerceEnabled()) {
$this->addWidget('Goals_EcommerceOverview', 'widgetGoalReport', array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER));
$this->addWidget('Goals_EcommerceLog', 'getEcommerceLog');
}
}
private function getIdSite()
{
return Common::getRequestVar('idSite', null, 'int');
}
}
/*!
* Piwik - free/libre analytics platform
*
* GoalsTable screenshot tests.
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
describe("Ecommerce", function () {
this.timeout(0);
var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
+ "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";
it("should load when the goals icon is clicked", function (done) {
expect.screenshot('initial').to.be.capture(function (page) {
page.load(url);
page.click('.tableIconsGroup a[data-footer-icon-id=tableGoals]');
}, done);
});
it("should show columns for all goals when idGoal is 0", function (done) {
expect.screenshot('goals_table_full').to.be.capture(function (page) {
var url = page.getCurrentUrl().replace(/viewDataTable=[^&]*/, "viewDataTable=tableGoals") + "&idGoal=0";
page.load(url);
}, done);
});
it("should show columns for a single goal when idGoal is 1", function (done) {
expect.screenshot('goals_table_single').to.be.capture(function (page) {
page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=1"));
}, done);
});
it("should show an ecommerce view when idGoal is ecommerceOrder", function (done) {
expect.screenshot('goals_table_ecommerce').to.be.capture(function (page) {
page.load(page.getCurrentUrl().replace(/idGoal=[^&]*/, "idGoal=ecommerceOrder"));
}, done);
});
it("should show a special view when idGoal is ecommerceOrder and viewDataTable is ecommerceOrder", function (done) {
expect.screenshot('goals_table_ecommerce_view').to.be.capture(function (page) {
var url = page.getCurrentUrl().replace(/moduleToWidgetize=[^&]*/, "moduleToWidgetize=Ecommerce")
.replace(/actionToWidgetize=[^&]*/, "actionToWidgetize=getItemsSku")
.replace(/viewDataTable=[^&]*/, "viewDataTable=ecommerceOrder");
page.load(url);
}, done);
});
it("should show abandoned carts data when the abandoned carts link is clicked", function (done) {
expect.screenshot('goals_table_abandoned_carts').to.be.capture(function (page) {
page.click('.tableIconsGroup a[data-footer-icon-id=ecommerceAbandonedCart]');
}, done);
});
});
\ No newline at end of file
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
namespace Piwik\Plugins\Goals; namespace Piwik\Plugins\Goals;
use Piwik\Common; use Piwik\Common;
use Piwik\Site;
use Piwik\Piwik;
class Widgets extends \Piwik\Plugin\Widgets class Widgets extends \Piwik\Plugin\Widgets
{ {
...@@ -31,12 +29,6 @@ class Widgets extends \Piwik\Plugin\Widgets ...@@ -31,12 +29,6 @@ class Widgets extends \Piwik\Plugin\Widgets
$this->addWidget($name, 'widgetGoalReport', $params); $this->addWidget($name, 'widgetGoalReport', $params);
} }
} }
$site = new Site($idSite);
if ($site->isEcommerceEnabled()) {
$this->addWidgetWithCustomCategory('Goals_Ecommerce', 'Goals_EcommerceOverview', 'widgetGoalReport', array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER));
$this->addWidgetWithCustomCategory('Goals_Ecommerce', 'Goals_EcommerceLog', 'getEcommerceLog');
}
} }
private function getIdSite() private function getIdSite()
......
...@@ -155,7 +155,7 @@ class Plugin_ConversionDimensionTest extends \PHPUnit_Framework_TestCase ...@@ -155,7 +155,7 @@ class Plugin_ConversionDimensionTest extends \PHPUnit_Framework_TestCase
foreach ($dimensions as $dimension) { foreach ($dimensions as $dimension) {
$this->assertInstanceOf('\Piwik\Plugin\Dimension\ConversionDimension', $dimension); $this->assertInstanceOf('\Piwik\Plugin\Dimension\ConversionDimension', $dimension);
$this->assertRegExp('/Piwik.Plugins.(ExampleTracker|Goals).Columns/', get_class($dimension)); $this->assertRegExp('/Piwik.Plugins.(ExampleTracker|Ecommerce|Goals).Columns/', get_class($dimension));
} }
} }
} }
\ No newline at end of file
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