diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-03 15:28:31 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:19 +0100 |
commit | 8b64e92b9262d2a2eec6345685ce421050f95c66 (patch) | |
tree | dd51490b8a184b2643414d11867a9fa450aa5065 /tests/lib/AppConfigTest.php | |
parent | 84e6e9f7cf19207041925eaa237d24e1c12c2c2d (diff) | |
download | nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.tar.gz nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.zip |
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/AppConfigTest.php')
-rw-r--r-- | tests/lib/AppConfigTest.php | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index d2643d599f3..d4ae66cb2f1 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -10,6 +10,7 @@ namespace Test; use OC\AppConfig; +use OC\DB\Connection; use OCP\IConfig; /** @@ -23,7 +24,7 @@ class AppConfigTest extends TestCase { /** @var \OCP\IAppConfig */ protected $appConfig; - /** @var \OCP\IDBConnection */ + /** @var Connection */ protected $connection; protected $originalConfig; @@ -31,7 +32,7 @@ class AppConfigTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->connection = \OC::$server->getDatabaseConnection(); + $this->connection = \OC::$server->get(Connection::class); $sql = $this->connection->getQueryBuilder(); $sql->select('*') ->from('appconfig'); @@ -138,7 +139,7 @@ class AppConfigTest extends TestCase { } public function testGetApps() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertEqualsCanonicalizing([ 'anotherapp', @@ -149,7 +150,7 @@ class AppConfigTest extends TestCase { } public function testGetKeys() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $keys = $config->getKeys('testapp'); $this->assertEqualsCanonicalizing([ @@ -162,7 +163,7 @@ class AppConfigTest extends TestCase { } public function testGetValue() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $value = $config->getValue('testapp', 'installed_version'); $this->assertConfigKey('testapp', 'installed_version', $value); @@ -175,7 +176,7 @@ class AppConfigTest extends TestCase { } public function testHasKey() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertTrue($config->hasKey('testapp', 'installed_version')); $this->assertFalse($config->hasKey('testapp', 'nonexistant')); @@ -183,13 +184,13 @@ class AppConfigTest extends TestCase { } public function testSetValueUpdate() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertEquals('1.2.3', $config->getValue('testapp', 'installed_version')); $this->assertConfigKey('testapp', 'installed_version', '1.2.3'); $wasModified = $config->setValue('testapp', 'installed_version', '1.2.3'); - if (!(\OC::$server->getDatabaseConnection() instanceof \OC\DB\OracleConnection)) { + if (!(\OC::$server->get(Connection::class) instanceof \OC\DB\OracleConnection)) { $this->assertFalse($wasModified); } @@ -207,7 +208,7 @@ class AppConfigTest extends TestCase { } public function testSetValueInsert() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertFalse($config->hasKey('someapp', 'somekey')); $this->assertNull($config->getValue('someapp', 'somekey')); @@ -219,13 +220,13 @@ class AppConfigTest extends TestCase { $this->assertConfigKey('someapp', 'somekey', 'somevalue'); $wasInserted = $config->setValue('someapp', 'somekey', 'somevalue'); - if (!(\OC::$server->getDatabaseConnection() instanceof \OC\DB\OracleConnection)) { + if (!(\OC::$server->get(Connection::class) instanceof \OC\DB\OracleConnection)) { $this->assertFalse($wasInserted); } } public function testDeleteKey() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertTrue($config->hasKey('testapp', 'deletethis')); @@ -247,7 +248,7 @@ class AppConfigTest extends TestCase { } public function testDeleteApp() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertTrue($config->hasKey('someapp', 'otherkey')); @@ -267,7 +268,7 @@ class AppConfigTest extends TestCase { } public function testGetValuesNotAllowed() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $this->assertFalse($config->getValues('testapp', 'enabled')); @@ -275,7 +276,7 @@ class AppConfigTest extends TestCase { } public function testGetValues() { - $config = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $config = new \OC\AppConfig(\OC::$server->get(Connection::class)); $sql = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $sql->select(['configkey', 'configvalue']) @@ -311,7 +312,7 @@ class AppConfigTest extends TestCase { public function testGetFilteredValues() { /** @var \OC\AppConfig|\PHPUnit\Framework\MockObject\MockObject $config */ $config = $this->getMockBuilder(\OC\AppConfig::class) - ->setConstructorArgs([\OC::$server->getDatabaseConnection()]) + ->setConstructorArgs([\OC::$server->get(Connection::class)]) ->setMethods(['getValues']) ->getMock(); @@ -333,8 +334,8 @@ class AppConfigTest extends TestCase { } public function testSettingConfigParallel() { - $appConfig1 = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); - $appConfig2 = new \OC\AppConfig(\OC::$server->getDatabaseConnection()); + $appConfig1 = new \OC\AppConfig(\OC::$server->get(Connection::class)); + $appConfig2 = new \OC\AppConfig(\OC::$server->get(Connection::class)); $appConfig1->getValue('testapp', 'foo', 'v1'); $appConfig2->getValue('testapp', 'foo', 'v1'); |