agent
agent copied to clipboard
How to get device information by phpunit
I wrote below on phpunit. public function testAccessAsiPhone() { $headers = [ 'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' ]; $this->withServerVariables($this->transformHeadersToServerVars($headers)); $this->visit('/') ->see('iPhone') ->see('iOS') ->see('Safari'); } }
but, device informatons look like don't get.
I wrote like this on controller. public function index(Request $request){ $device = $this->agent->device(); $platform = $this->agent->platform(); $browser = $this->agent->browser(); return Response::view('index', [ 'device' => $device, 'platform' => $platform, 'browser' => $browser ] ); }
Is it not possible to get device informations by phpunit?