Example #1
0
 /**
  * Update path and file name
  * 
  * @throws ServerFeedOutdated
  * @return void
  */
 private function updateFile()
 {
     if ($this->servers->isEmpty()) {
         $this->fetch();
         throw new \ServerFeedOutdated();
     }
     $this->full_path = $this->servers->pop();
     $this->filename = basename($this->full_path);
 }
 public function testPopPushPutShiftUnshiftInject()
 {
     // pop
     $_3 = $this->collection->pop();
     $this->assertEquals($this->_3, $_3);
     $this->assertEquals($this->_2, $this->collection->last());
     $this->assertEquals(3, $this->collection->count());
     // push
     $this->collection->push($_3);
     $this->assertEquals($this->_3, $this->collection->last());
     // put
     $this->collection->put(2, 'test');
     $this->assertEquals('test', $this->collection->get(2));
     // shift
     $_0 = $this->collection->shift();
     $this->assertEquals($this->_0, $_0);
     $this->assertEquals($this->_1, $this->collection->first());
     $this->assertEquals(3, $this->collection->count());
     // unshift
     $this->collection->unshift($_0);
     $this->assertEquals($this->_0, $this->collection->first());
     // inject
     $this->collection->inject(2, 'test2');
     $this->assertEquals('test2', $this->collection->get(2));
     $this->assertEquals(5, $this->collection->count());
 }