Piwik unit tests

Some of the tests require a database access. The database used for tests is different from your normal Piwik database. You may need to create this database ; you can edit the settings for the unit tests database access in your config file /config/global.ini.php

The database used in your tests is called "piwik_tests". Create it if necessary.

Run the tests by module


Piwik - running all tests

Piwik - running all tests

The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.
Exception: ../tests/core/API/DocumentationGenerator.test.php -> Test_Piwik_API_DocumentationGenerator -> test_callableApiMethods_doNotFail -> Unexpected exception of type [Zend_Db_Statement_Exception] with message [SQLSTATE[42S02]: Base table or view not found: 1146 Table 'piwik.piwiktests_site' doesn't exist] in [/var/www/piwik/libs/Zend/Db/Statement/Pdo.php line 227]
Exception: ../tests/core/Date.test.php -> Test_Piwik_Date -> test_today -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Date.test.php -> Test_Piwik_Date -> test_yesterday -> Equal expectation fails as [Boolean: false] does not match [Integer: 1246921200] at [/var/www/piwik/tests/core/Date.test.php line 37]
5e1b126475b83c837305d3dd6cde107bException: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_getId -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_getLabel -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_isFinished_today -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_isFinished_yesterday -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_isFinished_tomorrow -> Unexpected exception of type [Exception] with message [Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information)] in [/var/www/piwik/core/Date.php line 39]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_isFinished_31stfeb -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateStart1 -> Equal expectation fails at character 0 with [0000-03-03] and [2007-03-03] at [/var/www/piwik/tests/core/Period.test.php line 104]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateStart2 -> Equal expectation fails at character 0 with [0000-01-03] and [2007-01-03] at [/var/www/piwik/tests/core/Period.test.php line 120]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateStart3 -> Equal expectation fails at character 0 with [0000-12-31] and [2007-12-31] at [/var/www/piwik/tests/core/Period.test.php line 136]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateEnd1 -> Equal expectation fails at character 0 with [0000-03-03] and [2007-03-03] at [/var/www/piwik/tests/core/Period.test.php line 153]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateEnd2 -> Equal expectation fails at character 0 with [0000-04-15] and [2007-04-15] at [/var/www/piwik/tests/core/Period.test.php line 167]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_day_getDateEnd3 -> Equal expectation fails at character 0 with [0000-12-31] and [2007-12-31] at [/var/www/piwik/tests/core/Period.test.php line 180]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_Dec -> Equal expectation fails with member [0] at character 0 with [0000-12-01] and [2006-12-01] at [/var/www/piwik/tests/core/Period.test.php line 225]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_Dec -> Equal expectation fails as [Boolean: false] does not match [Boolean: true] at [/var/www/piwik/tests/core/Period.test.php line 227]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_FebLeap -> Equal expectation fails with member [0] at character 0 with [0000-02-01] and [2024-02-01] at [/var/www/piwik/tests/core/Period.test.php line 263]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_FebLeap -> Equal expectation fails as [Boolean: true] does not match [Boolean: false] at [/var/www/piwik/tests/core/Period.test.php line 265]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_FebNonLeap -> Equal expectation fails as key list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28] does not match key list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] at [/var/www/piwik/tests/core/Period.test.php line 300]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_FebNonLeap -> Equal expectation fails because [Integer: 29] differs from [Integer: 28] by 1 at [/var/www/piwik/tests/core/Period.test.php line 301]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_FebNonLeap -> Equal expectation fails as [Boolean: true] does not match [Boolean: false] at [/var/www/piwik/tests/core/Period.test.php line 302]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_Jan -> Equal expectation fails with member [0] at character 0 with [0000-01-01] and [2007-01-01] at [/var/www/piwik/tests/core/Period.test.php line 340]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_DSTChangeMarch -> Equal expectation fails with member [0] at character 0 with [0000-03-01] and [2007-03-01] at [/var/www/piwik/tests/core/Period.test.php line 381]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_month_DSTChangeOct -> Equal expectation fails with member [0] at character 0 with [0000-10-01] and [2017-10-01] at [/var/www/piwik/tests/core/Period.test.php line 420]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_Between2years -> Equal expectation fails with member [0] at character 0 with [0000-12-26] and [2005-12-26] at [/var/www/piwik/tests/core/Period.test.php line 447]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_Between2years -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_Between2month -> Equal expectation fails with member [0] at character 0 with [0000-05-29] and [2006-05-29] at [/var/www/piwik/tests/core/Period.test.php line 463]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_Between2month -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_febLeapyear -> Equal expectation fails with member [0] at character 0 with [0000-02-27] and [2023-02-27] at [/var/www/piwik/tests/core/Period.test.php line 480]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_febLeapyear -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_febnonLeapyear -> Equal expectation fails with member [0] at character 0 with [0000-02-26] and [2024-02-26] at [/var/www/piwik/tests/core/Period.test.php line 501]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_febnonLeapyear -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_middleofmonth -> Equal expectation fails with member [0] at character 0 with [0000-10-07] and [2024-10-07] at [/var/www/piwik/tests/core/Period.test.php line 522]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_week_middleofmonth -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_year_normalcase -> Unexpected exception of type [Exception] with message [Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information)] in [/var/www/piwik/core/Date.php line 39]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_year_pastAndWrongdate -> Unexpected exception of type [Exception] with message [Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information)] in [/var/www/piwik/core/Date.php line 39]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_today -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_2days -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_5days -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_previous3days -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_comma1 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_comma2 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_weekcomma1 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_yearcomma1 -> Unexpected exception of type [Exception] with message [Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information)] in [/var/www/piwik/core/Date.php line 39]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_monthcomma1 -> Equal expectation fails as [Boolean: false] does not match [Boolean: true] at [/var/www/piwik/tests/core/Period.test.php line 854]
Fail: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_monthcomma1 -> Equal expectation fails with member [0] with member [0] at character 0 with [0000-12-01] and [2006-12-01] at [/var/www/piwik/tests/core/Period.test.php line 855]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_week -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_week_last1 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_month -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_month_last1 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_previousmonth -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_year -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
Exception: ../tests/core/Period.test.php -> Test_Piwik_Period -> test_range_year_last1 -> Unexpected exception of type [Exception] with message [Piwik_Date is expecting a unix timestamp] in [/var/www/piwik/core/Date.php line 65]
The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.
The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_noTable -> piwiktests_archive_numeric_2000_09 !==array ( 0 => 'piwiktests_user', 1 => 'piwiktests_access', 2 => 'piwiktests_site', 3 => 'piwiktests_site_url', 4 => 'piwiktests_goal', 5 => 'piwiktests_logger_message', 6 => 'piwiktests_logger_api_call', 7 => 'piwiktests_logger_error', 8 => 'piwiktests_logger_exception', 9 => 'piwiktests_log_action', 10 => 'piwiktests_log_visit', 11 => 'piwiktests_log_conversion', 12 => 'piwiktests_log_link_visit_action', 13 => 'piwiktests_log_profiling', 14 => 'piwiktests_option', 15 => 'piwiktests_archive_numeric_0000_09', ) at [/var/www/piwik/tests/core/TablePartitioning.test.php line 49]
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_noTable -> Equal expectation fails at character 27 with [piwiktests_archive_numeric_2000_09] and [piwiktests_archive_numeric_0000_09] at [/var/www/piwik/tests/core/TablePartitioning.test.php line 51]
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_monthlyPartition -> at [/var/www/piwik/tests/core/TablePartitioning.test.php line 69]
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_monthlyPartition -> Equal expectation fails at character 27 with [piwiktests_archive_numeric_2000_09] and [piwiktests_archive_numeric_0000_09] at [/var/www/piwik/tests/core/TablePartitioning.test.php line 71]
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_dailyPartition -> at [/var/www/piwik/tests/core/TablePartitioning.test.php line 89]
Fail: ../tests/core/TablePartitioning.test.php -> Test_Piwik_TablePartitioning -> test_dailyPartition -> Equal expectation fails at character 27 with [piwiktests_archive_numeric_2000_09_10] and [piwiktests_archive_numeric_0000_09_10] at [/var/www/piwik/tests/core/TablePartitioning.test.php line 91]
The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.

Piwik_Url::getCurrentQueryStringWithParametersModified()
Piwik_Url::getCurrentUrl() http://box.briefcard.net/logs2/tests/all_tests.php
Piwik_Url::getCurrentUrlWithoutQueryString() http://box.briefcard.net/logs2/tests/all_tests.php
Piwik_Url::getCurrentUrlWithoutFileName() http://box.briefcard.net/logs2/tests/
Piwik_Url::getCurrentScriptName() /logs2/tests/all_tests.php
Piwik_Url::getCurrentScriptPath() /logs2/tests/
Piwik_Url::getCurrentHost() http://box.briefcard.net
Piwik_Url::getCurrentQueryString()
Piwik_Url::getArrayFromCurrentQueryString() array(0) { } The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.
26/27 test cases complete: 697 passes, 30 fails and 30 exceptions.
Time elapsed: 13.266s
Memory delta: 1.3 M