public function testIsReady()
 {
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_ERROR);
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_INVALIDATED);
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_ON_DEMAND);
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_PROCESSING);
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_QUEUED);
     $this->assertFalse($this->object->isReady());
     $this->object->setStatus(Variant::STATUS_READY);
     $this->assertTrue($this->object->isReady());
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public static function fromArray($array)
 {
     $variant = new Variant();
     if (isset($array['name'])) {
         $variant->setName($array['name']);
     }
     if (isset($array['filename'])) {
         $variant->setFilename($array['filename']);
     }
     if (isset($array['options'])) {
         $variant->setOptions($array['options']);
     }
     if (isset($array['mode'])) {
         $variant->setMode($array['mode']);
     }
     if (isset($array['status'])) {
         $variant->setStatus($array['status']);
     }
     if (isset($array['error'])) {
         $variant->setError($array['error']);
     }
     if (isset($array['meta']) && is_array($array['meta']) && !empty($array['meta'])) {
         $variant->setMeta($array['meta']);
     }
     return $variant;
 }