Пример #1
0
 public function testBasic()
 {
     $storage = new ArrayStorage();
     $storage->offsetSet('key', 'value');
     $this->assertEquals('value', $storage->offsetGet('key'), 'offsetGet after offsetSet');
     $this->assertEquals('value', $storage->get('key'), 'get after offsetSet');
     $this->assertEquals('value', $storage['key'], '[]get after offsetSet');
     $this->assertEquals('value', $storage->key, '__get after offsetSet');
     $storage->key2 = 'value2';
     $this->assertEquals('value2', $storage->key2, '__get after __set');
     $this->assertEquals('value2', $storage->get('key2'), 'get after __set');
     $this->assertEquals('value', $storage->getFirst(), 'first item getter');
     $this->assertEquals('value2', $storage->getLast(), 'last item getter');
 }