Ejemplo n.º 1
0
 /**
  * device whatHas test
  * @depends test_fetchArchive
  * @group ultimate
  **/
 public function test_ultimate_deviceDeviceWhatHas()
 {
     $hd = new HandsetDetection\HD4($this->cloudConfig);
     $reply = $hd->deviceWhatHas('design_dimensions', '101 x 44 x 16');
     $data = $hd->getReply();
     $this->assertEquals($reply, true);
     $this->assertEquals(0, $data['status']);
     $this->assertEquals('OK', $data['message']);
     $jsonString = json_encode($data['devices']);
     $this->assertEquals(true, preg_match('/Asus/', $jsonString));
     $this->assertEquals(true, preg_match('/V80/', $jsonString));
     $this->assertEquals(true, preg_match('/Spice/', $jsonString));
     $this->assertEquals(true, preg_match('/S900/', $jsonString));
     $this->assertEquals(true, preg_match('/Voxtel/', $jsonString));
     $this->assertEquals(true, preg_match('/RX800/', $jsonString));
 }
Ejemplo n.º 2
0
} else {
    print $hd->getError();
}
echo "</p>";
// View information for a specific handset
echo "<h1>Nokia N95 Properties</h1><p>";
if ($hd->deviceView('Nokia', 'N95')) {
    $data = $hd->getReply();
    print_r($data);
} else {
    print $hd->getError();
}
echo "</p>";
// What handset have this attribute ?
echo "<h1>Handsets with Network CDMA</h1><p>";
if ($hd->deviceWhatHas('network', 'CDMA')) {
    $data = $hd->getReply();
    print_r($data);
} else {
    print $hd->getError();
}
echo "</p>";
// ***************************** Detection Examples ********************************
// This is the most simple detection call - http headers are picked up automatically.
// You're probably using a normal browser so expect this to reply with NOTFOUND
echo "<h1>Simple Detection - Using your web browser standard headers (expect NotFound)</h1><p>";
if ($hd->deviceDetect()) {
    $tmp = $hd->getReply();
    print_r($tmp);
} else {
    print $hd->getError();