]> git.mxchange.org Git - friendica.git/commitdiff
Update & fix
authorPhilipp <admin@philipp.info>
Sat, 13 May 2023 20:18:00 +0000 (22:18 +0200)
committerPhilipp <admin@philipp.info>
Sat, 13 May 2023 20:18:00 +0000 (22:18 +0200)
src/Database/DBA.php
tests/src/Database/DatabaseTest.php

index e730b298d593885eb3ce0974a155d9ef29bc4ab9..e29a940689f0681deea96fcb9ebcdbaf942854ef 100644 (file)
@@ -841,7 +841,7 @@ class DBA
         */
        public static function deleteSleepingProcesses()
        {
-               return DI::dba()->delete();
+               return DI::dba()->deleteSleepingProcesses();
        }
 
        /**
index e95d655f19f6ed7add2bc547f6fe36c618674e8d..85c673f070d0cb7376c4213d6f36bab3652ce5ba 100644 (file)
@@ -21,6 +21,9 @@ class DatabaseTest extends FixtureTest
                $this->configFileManager = new ConfigFileManager($this->root->url(), $this->root->url() . '/config/', $this->root->url() . '/static/');
        }
 
+       /**
+        * Test, if directly updating a field is possible
+        */
        public function testUpdateIncrease()
        {
                $db = $this->getDbInstance();
@@ -30,13 +33,18 @@ class DatabaseTest extends FixtureTest
                self::assertEquals(1, $db->selectFirst('config', ['v'], ['cat' => 'test', 'k' => 'inc'])['v']);
        }
 
+       /**
+        * Test if combining directly field updates with normal updates is working
+        */
        public function testUpdateWithField()
        {
                $db = $this->getDbInstance();
 
                self::assertEquals('https://friendica.local', $db->selectFirst('gserver', ['url'], ['nurl' => 'http://friendica.local'])['url']);
-               self::assertTrue($db->update('gserver', ['site_name' => 'test', "`registered-users` = `registered-users` + 1", 'info' => 'another test'], ['nurl' => 'http://friendica.local']));
+               self::assertTrue($db->update('gserver', ['active-week-users' => 0], ['nurl' => 'http://friendica.local']));
+               self::assertTrue($db->update('gserver', ['site_name' => 'test', "`registered-users` = `registered-users` + 1", 'info' => 'another test', "`active-week-users` = `active-week-users` + 2"], ['nurl' => 'http://friendica.local']));
                self::assertEquals(1, $db->selectFirst('gserver', ['registered-users'], ['nurl' => 'http://friendica.local'])['registered-users']);
+               self::assertEquals(2, $db->selectFirst('gserver', ['active-week-users'], ['nurl' => 'http://friendica.local'])['active-week-users']);
                self::assertTrue($db->update('gserver', ['site_name' => 'test', "`registered-users` = `registered-users` + 1", 'info' => 'another test'], ['nurl' => 'http://friendica.local']));
                self::assertEquals(2, $db->selectFirst('gserver', ['registered-users'], ['nurl' => 'http://friendica.local'])['registered-users']);
                self::assertTrue($db->update('gserver', ['site_name' => 'test', "`registered-users` = `registered-users` - 1", 'info' => 'another test'], ['nurl' => 'http://friendica.local']));