Ejemplo n.º 1
0
 public function testSetValueUnchanged2()
 {
     $statementMock = $this->getMock('\\Doctrine\\DBAL\\Statement', array(), array(), '', false);
     $statementMock->expects($this->once())->method('fetch')->will($this->returnValue(false));
     $connectionMock = $this->getMock('\\OC\\DB\\Connection', array(), array(), '', false);
     $connectionMock->expects($this->once())->method('executeQuery')->with($this->equalTo('SELECT `configvalue`, `configkey` FROM `*PREFIX*appconfig`' . ' WHERE `appid` = ?'), $this->equalTo(array('bar')))->will($this->returnValue($statementMock));
     $connectionMock->expects($this->once())->method('insert')->with($this->equalTo('*PREFIX*appconfig'), $this->equalTo(array('appid' => 'bar', 'configkey' => 'foo', 'configvalue' => 'v1')));
     $connectionMock->expects($this->once())->method('update')->with($this->equalTo('*PREFIX*appconfig'), $this->equalTo(array('configvalue' => 'v2')), $this->equalTo(array('appid' => 'bar', 'configkey' => 'foo')));
     $appconfig = new OC\AppConfig($connectionMock);
     $appconfig->setValue('bar', 'foo', 'v1');
     $appconfig->setValue('bar', 'foo', 'v2');
     $appconfig->setValue('bar', 'foo', 'v2');
 }
Ejemplo n.º 2
0
 public function testSettingConfigParallel()
 {
     $appConfig1 = new \OC\AppConfig(\OC::$server->getDatabaseConnection());
     $appConfig2 = new \OC\AppConfig(\OC::$server->getDatabaseConnection());
     $appConfig1->getValue('testapp', 'foo', 'v1');
     $appConfig2->getValue('testapp', 'foo', 'v1');
     $appConfig1->setValue('testapp', 'foo', 'v1');
     $this->assertConfigKey('testapp', 'foo', 'v1');
     $appConfig2->setValue('testapp', 'foo', 'v2');
     $this->assertConfigKey('testapp', 'foo', 'v2');
 }