2021-02-15 06:54:21 +13:00
|
|
|
<?php
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
namespace Tests\Unit\Detector;
|
2021-02-15 06:54:21 +13:00
|
|
|
|
|
|
|
use Appwrite\Detector\Detector;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class DetectorTest extends TestCase
|
|
|
|
{
|
2022-08-01 22:22:04 +12:00
|
|
|
protected ?Detector $object = null;
|
2021-02-15 06:54:21 +13:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->object = new Detector('Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown(): void
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
public function testGetOS(): void
|
2021-02-15 06:54:21 +13:00
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->getOS(), [
|
|
|
|
'osCode' => 'WIN',
|
|
|
|
'osName' => 'Windows',
|
|
|
|
'osVersion' => '7',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
public function testGetClient(): void
|
2021-02-15 06:54:21 +13:00
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->getClient(), [
|
|
|
|
'clientType' => 'browser',
|
|
|
|
'clientCode' => 'FF',
|
|
|
|
'clientName' => 'Firefox',
|
|
|
|
'clientVersion' => '47.0',
|
|
|
|
'clientEngine' => 'Gecko',
|
2021-02-23 01:30:28 +13:00
|
|
|
'clientEngineVersion' => '47.0',
|
2021-02-15 06:54:21 +13:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
public function testGetDevice(): void
|
2021-02-15 06:54:21 +13:00
|
|
|
{
|
|
|
|
$this->assertEquals($this->object->getDevice(), [
|
|
|
|
'deviceName' => 'desktop',
|
|
|
|
'deviceBrand' => '',
|
|
|
|
'deviceModel' => '',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|