コード例 #1
0
 /**
  * Does not really test anything by PHPUnit, since $_SERVER array does not contain HTTP_USER_AGENT
  */
 public function testDefaultCharacteristicsSetCurrentHTTPheaders()
 {
     $currentHTTPheaders = array();
     $currentHTTPheaders['user_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
     if (isset($_SERVER["HTTP_X_WAP_PROFILE"])) {
         $currentHTTPheaders["x-wap-profile"] = $_SERVER["HTTP_X_WAP_PROFILE"];
     }
     if (isset($_SERVER["HTTP_ACCEPT"])) {
         $currentHTTPheaders["accept"] = $_SERVER["HTTP_ACCEPT"];
     }
     $deviceInfo = new \GodsDev\DefaultDeviceConnector\DefaultDeviceConnector();
     $deviceInfo->defaultCharacteristics();
     $this->assertEquals($currentHTTPheaders, $deviceInfo->getCharacteristics());
 }
コード例 #2
0
<?php

require_once __DIR__ . '/../src/DefaultDeviceConnector.php';
$deviceProperties = new GodsDev\DefaultDeviceConnector\DefaultDeviceConnector('http://m.t-mobile.cz/services/defaultdevice/api/v2/request/');
$deviceProperties->defaultCharacteristics();
var_dump($deviceProperties->request());