Download plugins/CoreVisualizations/tests/Unit/SparklinesTest.php from Leon4gr45/matomo: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CoreVisualizations/tests/Unit/SparklinesTest.php
- Command line
-
hf download hf://spaces/Leon4gr45/matomo/plugins/CoreVisualizations/tests/Unit/SparklinesTest.php
-
curl -L -o SparklinesTest.php https://huggingface.co/spaces/Leon4gr45/matomo/resolve/main/plugins/CoreVisualizations/tests/Unit/SparklinesTest.php
1.17 kB
| /** | |
| * Matomo - free/libre analytics platform | |
| * | |
| * @link https://matomo.org | |
| * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | |
| */ | |
| namespace Piwik\Plugins\CoreVisualizations\tests\Unit; | |
| use Piwik\DataTable\Row; | |
| use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines; | |
| /** | |
| * @group CoreVisualizations | |
| * @group Sparklines | |
| * @group Plugins | |
| */ | |
| class SparklinesTest extends \PHPUnit\Framework\TestCase | |
| { | |
| public function testFindComparisonRowMatchesNormalizedRangeDate() | |
| { | |
| $expectedRow = new Row(['columns' => ['nb_conversions' => 1]]); | |
| $comparisonRows = [ | |
| '' => [ | |
| 'month' => [ | |
| '2026-03-01,2026-03-31' => $expectedRow, | |
| ], | |
| ], | |
| ]; | |
| $reflection = new \ReflectionClass(Sparklines::class); | |
| $sparklines = $reflection->newInstanceWithoutConstructor(); | |
| $method = $reflection->getMethod('findComparisonRow'); | |
| $method->setAccessible(true); | |
| $actualRow = $method->invoke($sparklines, $comparisonRows, '', 'month', '2026-03-01'); | |
| $this->assertSame($expectedRow, $actualRow); | |
| } | |
| } | |