Esempio n. 1
0
 /**
  * Tests storeData()
  *
  * @return void
  */
 public function testStoreData()
 {
     $response = 'OK devid=2&fid=943794&path=http://127.0.0.1:7500/dev2/0/000/943/0000943794.fid';
     $this->object->expects($this->any())->method('socketRead')->will($this->returnValue($response));
     $this->object->expects($this->any())->method('curlExec')->will($this->returnValue(true));
     // Suppress warning from fopen()
     $result = $this->object->storeData('foobarkey', 'myclass', $this->fileData);
     $this->assertNull($result);
 }
Esempio n. 2
0
 /**
  * Constructor.
  *
  * @param array  $hosts   Array of trackers as 'hostname:port'
  * @param string $domain  The mogile domain.
  * @param array  $options Optional.  Array of option values.
  *
  * @throws File_Mogile_Exception
  */
 public function __construct(array $hosts, $domain = null, array $options = null)
 {
     if (is_array($options)) {
         foreach ($options as $name => $value) {
             switch ($name) {
                 case 'socketTimeout':
                     self::$socketTimeout = floatval($value);
                     break;
                 case 'streamTimeoutSeconds':
                     self::$streamTimeoutSeconds = (int) $value;
                     break;
                 case 'streamTimeoutMicroSeconds':
                     self::$streamTimeoutMicroSeconds = (int) $value;
                     break;
                 case 'commandTimeout':
                     self::$commandTimeout = intval($value);
                     break;
                 default:
                     throw new File_Mogile_Exception('Unrecognized option');
             }
         }
     }
     $this->_domain = $domain;
     shuffle($hosts);
     $this->hosts = $hosts;
     $this->connect();
 }
Esempio n. 3
0
 /**
  * __construct 
  * 
  * @param array  $hosts   Array of trackers as 'hostname:port'
  * @param string $domain  The mogile domain.
  * @param array  $options Optional.  Array of option values.
  * 
  * @access public
  * @return void
  */
 public function __construct(array $hosts, $domain = null, array $options = null)
 {
     // make sure chunksize is smaller than memory_limit
     $this->checkChunkSize($this->_chunksize);
     parent::__construct($hosts, $domain, $options);
 }