From 8835f4d154bbcd953a3488dfdefa71cb524ecfb8 Mon Sep 17 00:00:00 2001 From: dloosley <dloosley@glenfield-assoc.co.uk> Date: Sat, 18 Jun 2022 16:11:29 +0100 Subject: [PATCH 1/4] Corrected AR HitCounter::tableName() --- src/entities/HitCounter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entities/HitCounter.php b/src/entities/HitCounter.php index f4a1711..8a9a941 100644 --- a/src/entities/HitCounter.php +++ b/src/entities/HitCounter.php @@ -51,7 +51,7 @@ class HitCounter extends \yii\db\ActiveRecord */ public static function tableName() { - return 'hit_counter'; + return '{{%hit_counter}}'; } From 85c4c626b09104268fb19a0b18a62fc7008d412a Mon Sep 17 00:00:00 2001 From: dloosley <dloosley@glenfield-assoc.co.uk> Date: Mon, 27 Jun 2022 21:33:11 +0100 Subject: [PATCH 2/4] Fix void return type --- composer.json | 39 ++++++++++------------- tests/TestCase.php | 4 +-- tests/functional/HitCounterWidgetTest.php | 2 +- tests/unit/HitCounterControllerTest.php | 2 +- tests/unit/HitCounterEntityTest.php | 2 +- tests/unit/HitCounterModelTest.php | 2 +- tests/unit/HitCounterRepositoryTest.php | 3 +- tests/unit/HitCounterServiceTest.php | 3 +- 8 files changed, 25 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 2c46472..db6afe3 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,13 @@ ], "require": { - "php": ">=5.6.0", - "yiisoft/yii2": "^2.0.0", - "piwik/device-detector": "~3.12", - "mockery/mockery": "^1.2" + "mockery/mockery": "^1.2", + "php": ">=7.4.0", + "yiisoft/yii2": "^2.0.45", + "matomo/device-detector": "^6.0" }, "require-dev": { - "phpunit/phpunit": "~5.0" + "phpunit/phpunit": "~9.5.0" }, "autoload": { "psr-4": { @@ -37,23 +37,18 @@ }, "config": { + "allow-plugins": { + "yiisoft/yii2-composer" : true + }, + "process-timeout": 1800, "fxp-asset": { - "installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" - } - }, - "process-timeout": 1800 + "enabled": false + } }, - "extra": { - "asset-installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" - }, - "asset-vcs-driver-options": { - "github-no-api": true - }, - "asset-pattern-skip-version": "(-patch)" - } - + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ] } diff --git a/tests/TestCase.php b/tests/TestCase.php index 483bb6c..aa39b10 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -13,7 +13,7 @@ */ abstract class TestCase extends \PHPUnit\Framework\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockWebApplication(); @@ -22,7 +22,7 @@ protected function setUp() * Clean up after test. * By default the application created with [[mockApplication]] will be destroyed. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->destroyApplication(); diff --git a/tests/functional/HitCounterWidgetTest.php b/tests/functional/HitCounterWidgetTest.php index 0de37b5..2c2a461 100644 --- a/tests/functional/HitCounterWidgetTest.php +++ b/tests/functional/HitCounterWidgetTest.php @@ -8,7 +8,7 @@ class HitCounterWidgetTest extends \tests\TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); $this->mockWebApplication(); diff --git a/tests/unit/HitCounterControllerTest.php b/tests/unit/HitCounterControllerTest.php index 46910df..d81e5aa 100644 --- a/tests/unit/HitCounterControllerTest.php +++ b/tests/unit/HitCounterControllerTest.php @@ -18,7 +18,7 @@ class HitCounterControllerTest extends \tests\TestCase { private $serviceMock; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/unit/HitCounterEntityTest.php b/tests/unit/HitCounterEntityTest.php index db4ec2d..95ffc26 100644 --- a/tests/unit/HitCounterEntityTest.php +++ b/tests/unit/HitCounterEntityTest.php @@ -11,7 +11,7 @@ class HitCounterEntityTest extends \tests\TestCase{ private $hit; private $arrayData; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/unit/HitCounterModelTest.php b/tests/unit/HitCounterModelTest.php index 22f2403..01dab39 100644 --- a/tests/unit/HitCounterModelTest.php +++ b/tests/unit/HitCounterModelTest.php @@ -10,7 +10,7 @@ class HitCounterModelTest extends \tests\TestCase{ private $model; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/unit/HitCounterRepositoryTest.php b/tests/unit/HitCounterRepositoryTest.php index 219e033..ed6eaa9 100644 --- a/tests/unit/HitCounterRepositoryTest.php +++ b/tests/unit/HitCounterRepositoryTest.php @@ -12,11 +12,10 @@ class HitCounterRepositoryTest extends \tests\TestCase { - private $hit; private $repo; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/unit/HitCounterServiceTest.php b/tests/unit/HitCounterServiceTest.php index 63849b7..b3deffa 100644 --- a/tests/unit/HitCounterServiceTest.php +++ b/tests/unit/HitCounterServiceTest.php @@ -17,11 +17,10 @@ class HitCounterServiceTest extends \tests\TestCase { - private $service; // private $request; - protected function setUp() + protected function setUp(): void { parent::setUp(); From e93e323e09b368bf73d97b2b99d965912afd9757 Mon Sep 17 00:00:00 2001 From: dloosley <dloosley@glenfield-assoc.co.uk> Date: Tue, 5 Jul 2022 10:01:24 +0100 Subject: [PATCH 3/4] Fixed Cn_c undefined error in javascript --- src/widgets/hitCounter/views/invisible-counter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/hitCounter/views/invisible-counter.php b/src/widgets/hitCounter/views/invisible-counter.php index 00ae83a..9b6c58e 100644 --- a/src/widgets/hitCounter/views/invisible-counter.php +++ b/src/widgets/hitCounter/views/invisible-counter.php @@ -62,7 +62,7 @@ ?>if(Cd.cookie)Cp+="&c=1";<?php ?>if(self!=top)Cp+="&f=1";<?php ?>if(Cn)Cp+="&lg="+Cn.language;<?php -?>if(Cn)Cp+="&cnt="+Cn_c.effectiveType;<?php +?>if(Cn&Cn_c)Cp+="&cnt="+Cn_c.effectiveType;<?php ?>if(Cn)Cp+="&ram="+Cn.deviceMemory;<?php ?>if('ontouchstart' in window || Cn.msMaxTouchPoints)Cp+="&td=1";<?php ?>if(Intl)Cp+="&tz="+Intl.DateTimeFormat().resolvedOptions().timeZone;<?php From 40c659ac1f44deb009e7fd959def9568b0febc91 Mon Sep 17 00:00:00 2001 From: dloosley <dloosley@glenfield-assoc.co.uk> Date: Tue, 5 Jul 2022 13:24:45 +0100 Subject: [PATCH 4/4] Correct javascript logical operator --- src/widgets/hitCounter/views/invisible-counter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/hitCounter/views/invisible-counter.php b/src/widgets/hitCounter/views/invisible-counter.php index 9b6c58e..7e903c7 100644 --- a/src/widgets/hitCounter/views/invisible-counter.php +++ b/src/widgets/hitCounter/views/invisible-counter.php @@ -62,7 +62,7 @@ ?>if(Cd.cookie)Cp+="&c=1";<?php ?>if(self!=top)Cp+="&f=1";<?php ?>if(Cn)Cp+="&lg="+Cn.language;<?php -?>if(Cn&Cn_c)Cp+="&cnt="+Cn_c.effectiveType;<?php +?>if(Cn&&Cn_c)Cp+="&cnt="+Cn_c.effectiveType;<?php ?>if(Cn)Cp+="&ram="+Cn.deviceMemory;<?php ?>if('ontouchstart' in window || Cn.msMaxTouchPoints)Cp+="&td=1";<?php ?>if(Intl)Cp+="&tz="+Intl.DateTimeFormat().resolvedOptions().timeZone;<?php