Esempio n. 1
0
 /**
  * @param array $data
  * @return $this
  */
 public function import(array $data)
 {
     $this->id = $data['id'];
     $this->name = $data['name'];
     $this->deviceMakeId = $data['device_make_id'];
     $this->deviceType = $data['device_type'];
     $this->screenWidth = $data['screen_width'] ?: 0;
     $this->screenHeight = $data['screen_height'] ?: 0;
     $this->supportsJS = $data['supports_js'];
     $this->supportsCookies = $data['supports_cookies'];
     $this->supportsFlash = $data['supports_flash'];
     $this->supportsGEO = $data['supports_geo'];
     $this->supportsHTMLVideo = $data['supports_html_video'];
     $this->supportsHTMLAudio = $data['supports_html_audio'];
     $this->deviceMakeName = $data['device_make_name'];
     if (isset($data['codes']) && $data['codes']) {
         foreach ($data['codes'] as $code) {
             $codeObj = new Code();
             $this->codes[] = $codeObj->import($code);
         }
     }
     return $this;
 }
Esempio n. 2
0
 public function testDeviceModelCodeServiceImport()
 {
     foreach ($this->getData('device-model', 'device-models') as $data) {
         if (isset($data['codes']) && is_array($data['codes'])) {
             foreach ($data['codes'] as $code) {
                 $obj = new DeviceModel\Code();
                 $obj->import($code);
                 $this->assertEquals($code['code'], $obj->getCode());
                 $this->assertEquals($code['device_model_id'], $obj->getDeviceModelId());
                 $this->assertEquals($code['id'], $obj->getId());
                 $this->assertEquals($code['notes'], $obj->getNotes());
                 $this->assertInternalType('string', $obj->getCode());
                 $this->assertInternalType('int', $obj->getDeviceModelId());
                 $this->assertInternalType('int', $obj->getId());
                 $this->assertInternalType('string', $obj->getNotes());
             }
         }
     }
 }