Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PHPUnit/Integration/Tracker/ModelTest.php')
-rw-r--r--tests/PHPUnit/Integration/Tracker/ModelTest.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/Tracker/ModelTest.php b/tests/PHPUnit/Integration/Tracker/ModelTest.php
index b14c066afc..4d8f940b90 100644
--- a/tests/PHPUnit/Integration/Tracker/ModelTest.php
+++ b/tests/PHPUnit/Integration/Tracker/ModelTest.php
@@ -7,7 +7,9 @@
*/
namespace Piwik\Tests\Integration\Tracker;
+use Matomo\Network\IPUtils;
use Piwik\Common;
+use Piwik\Date;
use Piwik\Db;
use Piwik\Tests\Fixtures\OneVisitorTwoVisits;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
@@ -28,13 +30,36 @@ class ModelTest extends IntegrationTestCase
*/
private $model;
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
$this->model = new Model();
}
+ public function test_hasVisit() {
+ $this->model->createVisit(array(
+ 'idvisitor' => hex2bin('1234567812345678'),
+ 'config_id' => '1234567',
+ 'location_ip' => IPUtils::binaryToStringIP('10.10.10.10'),
+ 'idvisit' => '4',
+ 'idsite' => '3',
+ 'visitor_count_visits' => 0,
+ 'visit_total_time' => 0,
+ 'visit_first_action_time' => Date::now()->getDatetime(),
+ 'visit_last_action_time' => Date::now()->getDatetime(),
+ ));
+
+ $this->assertTrue($this->model->hasVisit(3, 4));
+ $this->assertTrue($this->model->hasVisit('3', '4'));
+
+ // idsite not match
+ $this->assertFalse($this->model->hasVisit(9, 4));
+
+ // idvisit not match
+ $this->assertFalse($this->model->hasVisit(3, 8));
+ }
+
public function test_createNewIdAction_CreatesNewAction_WhenNoActionWithSameNameAndType()
{
$newIdAction = $this->model->createNewIdAction(self::TEST_ACTION_NAME, self::TEST_ACTION_TYPE, self::TEST_ACTION_URL_PREFIX);