File tree Expand file tree Collapse file tree
tests/phpunit/wpmatomo/report Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 backupGlobals =" false"
66 colors =" true"
77 xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/10.4/phpunit.xsd"
8- testdox =" true"
98>
109 <testsuites >
1110 <testsuite name =" integration" >
Original file line number Diff line number Diff line change 44 */
55
66use WpMatomo \Report \Dates ;
7+ use WpMatomo \User ;
78
89class ReportDatesTest extends MatomoAnalytics_TestCase {
910
@@ -12,10 +13,13 @@ class ReportDatesTest extends MatomoAnalytics_TestCase {
1213 */
1314 private $ dates ;
1415
16+ private $ user_id ;
17+
1518 public function setUp (): void {
1619 parent ::setUp ();
1720
18- $ this ->dates = new Dates ();
21+ $ this ->dates = new Dates ();
22+ $ this ->user_id = $ this ->create_set_super_admin ();
1923 }
2024
2125 public function test_get_supported_dates () {
@@ -54,7 +58,9 @@ public function get_report_dates() {
5458 public function test_get_date_from_query ( $ query , $ default_date , $ expected ) {
5559 $ _REQUEST = $ query ;
5660
57- wp_set_current_user ( 1 );
61+ wp_set_current_user ( $ this ->user_id );
62+ // reloadAccess will not execute if the current user has super user access
63+ \Piwik \Access::getInstance ()->setSuperUserAccess ( false );
5864 \Piwik \Access::getInstance ()->reloadAccess ( new \Piwik \Plugins \WordPress \SessionAuth () );
5965
6066 $ login = \Piwik \Access::getInstance ()->getLogin ();
You can’t perform that action at this time.
0 commit comments