diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-02-27 13:08:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 13:08:45 +0300 |
commit | 93aef4865cfdee9fcfa5acc9ff1950459a0af42e (patch) | |
tree | aa8ad643d8ad233ffb2b033a437bcd2b71274877 /plugins/Insights | |
parent | f28c7fa6cb6c63c8f459206448c7dcb93568099e (diff) |
Update to PHPUnit 8.5 (#15581)
* use latest phpunit/phpunit ~8.5
* submodule updates
* fixes
Diffstat (limited to 'plugins/Insights')
9 files changed, 19 insertions, 22 deletions
diff --git a/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php b/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php index b6d98eff4b..28c26c0bd2 100644 --- a/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php +++ b/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php @@ -21,13 +21,13 @@ class SomeVisitsDifferentPathsOnTwoDays extends Fixture public $date1 = '2010-12-14'; public $date2 = '2010-12-13'; - public function setUp() + public function setUp(): void { $this->setUpWebsitesAndGoals(); $this->trackVisits(); } - public function tearDown() + public function tearDown(): void { // empty } diff --git a/plugins/Insights/tests/Integration/ApiTest.php b/plugins/Insights/tests/Integration/ApiTest.php index 774a9e54c5..31f3ddba73 100644 --- a/plugins/Insights/tests/Integration/ApiTest.php +++ b/plugins/Insights/tests/Integration/ApiTest.php @@ -35,7 +35,7 @@ class ApiTest extends SystemTestCase private $api; private $idSite; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -45,7 +45,7 @@ class ApiTest extends SystemTestCase $this->api = API::getInstance(); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); @@ -88,7 +88,7 @@ class ApiTest extends SystemTestCase 'evolutionDifference' => -9 ); - $this->assertInternalType('array', $metadata['report']); + self::assertIsArray($metadata['report']); $this->assertEquals('Actions', $metadata['report']['module']); $this->assertEquals('getPageUrls', $metadata['report']['action']); unset($metadata['report']); diff --git a/plugins/Insights/tests/Integration/ModelTest.php b/plugins/Insights/tests/Integration/ModelTest.php index 01643700f8..9cde8a09cc 100644 --- a/plugins/Insights/tests/Integration/ModelTest.php +++ b/plugins/Insights/tests/Integration/ModelTest.php @@ -18,7 +18,6 @@ use Piwik\Tests\Framework\TestCase\SystemTestCase; * @group Insights * @group ModelTest * @group Plugins - * @group Plugins */ class ModelTest extends SystemTestCase { @@ -32,7 +31,7 @@ class ModelTest extends SystemTestCase */ private $model; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -101,7 +100,7 @@ class ModelTest extends SystemTestCase $total = $this->model->getMetricTotalValue($table, 'nb_visits'); $this->assertEquals(17, $total); - $this->assertInternalType('integer', $total); + self::assertIsInt($total); } public function test_getMetricTotalValue_shouldReturnZeroIfMetricHasNoTotal() @@ -114,11 +113,10 @@ class ModelTest extends SystemTestCase $this->assertEquals(0, $total); } - /** - * @expectedException \Exception - */ public function test_getLastDate_shouldThrowExceptionIfNotPossibleToGetLastDate() { + $this->expectException(\Exception::class); + $this->model->getLastDate('last10', 'day', 1); } diff --git a/plugins/Insights/tests/Unit/FilterExcludeLowValueTest.php b/plugins/Insights/tests/Unit/FilterExcludeLowValueTest.php index 7e9fba07c3..c63dac03b4 100644 --- a/plugins/Insights/tests/Unit/FilterExcludeLowValueTest.php +++ b/plugins/Insights/tests/Unit/FilterExcludeLowValueTest.php @@ -20,7 +20,7 @@ use Piwik\Plugins\Insights\DataTable\Filter\ExcludeLowValue; */ class FilterExcludeLowValueTest extends BaseUnitTest { - public function setUp() + public function setUp(): void { $this->table = new DataTable(); $this->table->addRowsFromArray(array( diff --git a/plugins/Insights/tests/Unit/FilterInsightTest.php b/plugins/Insights/tests/Unit/FilterInsightTest.php index bf98eab975..be5acb7324 100644 --- a/plugins/Insights/tests/Unit/FilterInsightTest.php +++ b/plugins/Insights/tests/Unit/FilterInsightTest.php @@ -30,7 +30,7 @@ class FilterInsightTest extends BaseUnitTest */ private $pastTable; - public function setUp() + public function setUp(): void { $this->currentTable = new DataTable(); $this->currentTable->addRowsFromArray(array( diff --git a/plugins/Insights/tests/Unit/FilterLimitTest.php b/plugins/Insights/tests/Unit/FilterLimitTest.php index 0eec585b68..184b95467a 100644 --- a/plugins/Insights/tests/Unit/FilterLimitTest.php +++ b/plugins/Insights/tests/Unit/FilterLimitTest.php @@ -20,7 +20,7 @@ use Piwik\Plugins\Insights\DataTable\Filter\Limit; */ class FilterLimitTest extends BaseUnitTest { - public function setUp() + public function setUp(): void { $this->table = new DataTable(); $this->table->addRowsFromArray(array( diff --git a/plugins/Insights/tests/Unit/FilterMinGrowthTest.php b/plugins/Insights/tests/Unit/FilterMinGrowthTest.php index 76434ade21..d8740e4203 100644 --- a/plugins/Insights/tests/Unit/FilterMinGrowthTest.php +++ b/plugins/Insights/tests/Unit/FilterMinGrowthTest.php @@ -21,7 +21,7 @@ use Piwik\Plugins\Insights\DataTable\Filter\MinGrowth; class FilterMinGrowthTest extends BaseUnitTest { - public function setUp() + public function setUp(): void { $this->table = new DataTable(); $this->table->addRowsFromArray(array( diff --git a/plugins/Insights/tests/Unit/FilterOrderByTest.php b/plugins/Insights/tests/Unit/FilterOrderByTest.php index 2b67f7aeb4..d18387eb4c 100644 --- a/plugins/Insights/tests/Unit/FilterOrderByTest.php +++ b/plugins/Insights/tests/Unit/FilterOrderByTest.php @@ -21,7 +21,7 @@ use Piwik\Tests\Framework\TestCase\SystemTestCase; */ class FilterOrderByTest extends BaseUnitTest { - public function setUp() + public function setUp(): void { $this->table = new DataTable(); } diff --git a/plugins/Insights/tests/Unit/InsightReportTest.php b/plugins/Insights/tests/Unit/InsightReportTest.php index 34518321ba..98b54a100a 100644 --- a/plugins/Insights/tests/Unit/InsightReportTest.php +++ b/plugins/Insights/tests/Unit/InsightReportTest.php @@ -55,7 +55,7 @@ class InsightReportTest extends \PHPUnit\Framework\TestCase */ // TODO use data providers - public function setUp() + public function setUp(): void { $this->currentTable = new DataTable(); $this->currentTable->addRowsFromArray(array( @@ -110,12 +110,11 @@ class InsightReportTest extends \PHPUnit\Framework\TestCase ); } - /** - * @expectedException \Exception - * @expectedExceptionMessage Unsupported orderBy - */ public function test_generateInsight_Order_ShouldThrowException_IfInvalid() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Unsupported orderBy'); + $this->generateInsight(2, 2, 2, 17, -17, 'InvalidOrDeRbY'); } @@ -270,7 +269,7 @@ class InsightReportTest extends \PHPUnit\Framework\TestCase 'minDisappearedPercent' => 8, ); - $this->assertInternalType('array', $metadata['report']); + self::assertIsArray($metadata['report']); $this->assertEquals('TestReport', $metadata['report']['name']); unset($metadata['report']); unset($metadata['totals']); |