diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-31 04:34:10 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-31 04:34:10 +0300 |
commit | b3f4f69ec2c0f7ae77461ffcfa57bc9073e290ae (patch) | |
tree | 67a4cc8feb08599fc36264a356e18f05e35094cc /plugins/CoreAdminHome/tests | |
parent | 873fb6f70ecb8d08b374353deb1c47ee2b23fadc (diff) |
Refs #7560, if old list is found in DB for ArchivesToPurgeDistributedList, convert it to new list w/ only year-date to avoid error.
Diffstat (limited to 'plugins/CoreAdminHome/tests')
-rw-r--r-- | plugins/CoreAdminHome/tests/Integration/ArchivesToPurgeDistributedListTest.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/CoreAdminHome/tests/Integration/ArchivesToPurgeDistributedListTest.php b/plugins/CoreAdminHome/tests/Integration/ArchivesToPurgeDistributedListTest.php new file mode 100644 index 0000000000..762e59a445 --- /dev/null +++ b/plugins/CoreAdminHome/tests/Integration/ArchivesToPurgeDistributedListTest.php @@ -0,0 +1,37 @@ +<?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\CoreAdminHome\tests\Integration; + +use Piwik\Option; +use Piwik\Plugins\CoreAdminHome\Tasks\ArchivesToPurgeDistributedList; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; + +/** + * @group Core + */ +class ArchivesToPurgeDistributedListTest extends IntegrationTestCase +{ + public function test_construct_CorrectlyConvertsOldListValues() + { + $oldItems = array( + '2015_01' => array(1,2,3), + '2013_02' => array(3), + 3 => '2015_03', + '2014_01' => array(), + 4 => '2015_06' + ); + Option::set(ArchivesToPurgeDistributedList::OPTION_INVALIDATED_DATES_SITES_TO_PURGE, serialize($oldItems)); + + $list = new ArchivesToPurgeDistributedList(); + $items = $list->getAll(); + + $expected = array('2015_03', '2015_06', '2015_01', '2013_02', '2014_01'); + $this->assertEquals($expected, array_values($items)); + } +}
\ No newline at end of file |