Пример #1
0
 public function save()
 {
     if (!$this->isModified()) {
         return FALSE;
     }
     $this->serializer->write($this->value);
     $this->modified = FALSE;
     return TRUE;
 }
Пример #2
0
 /**
  * Test read
  */
 public function testOffsetUnsetOnce()
 {
     $this->serializer->expects($this->once())->method('read')->will($this->returnValue('ONE,TWO,THREE'));
     unset($this->fixture[0]);
     $this->assertEquals(2, count($this->fixture));
     $this->assertTrue($this->fixture->isModified());
 }
Пример #3
0
 private function lazyInitialization()
 {
     $value = $this->serializer->read();
     if (is_null($value)) {
         $this->data = NULL;
     } elseif ($value === '') {
         $this->data = new \ArrayObject();
     } else {
         $this->data = new \ArrayObject(explode($this->separator, $value));
     }
     $this->modified = FALSE;
 }
 public function testSaveNotModified()
 {
     $this->serializer->expects($this->never())->method('write');
     $this->object->save();
 }
Пример #5
0
 public function testSaveUninitialized()
 {
     $this->serializer->expects($this->never())->method('write')->withAnyParameters();
     $this->assertFalse($this->fixture->save());
 }