-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDeviceDetectorTest.php
32 lines (24 loc) · 1010 Bytes
/
DeviceDetectorTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Reefki\DeviceDetector\Tests;
use DeviceDetector\DeviceDetector;
use Illuminate\Http\Request;
use Reefki\DeviceDetector\Device;
class DeviceDetectorTest extends TestCase
{
/** @test */
public function it_can_detect_device_from_a_request()
{
$request = Request::create('/', 'GET', [], [], [], [
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
]);
$this->assertInstanceOf(DeviceDetector::class, $request->device());
$detector = Device::detectRequest($request);
$this->assertInstanceOf(DeviceDetector::class, $detector);
}
/** @test */
public function it_can_detect_user_agent_string()
{
$device = Device::detect('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36');
$this->assertInstanceOf(DeviceDetector::class, $device);
}
}