@@ -65,12 +65,12 @@ protected function getFile(int $fileId): array {
6565 return $ query ->executeQuery ()->fetchAllAssociative ();
6666 }
6767
68- protected function getMounts (int $ storageId ): array {
68+ protected function getMountsCount (int $ storageId ): int {
6969 $ query = $ this ->connection ->getQueryBuilder ();
70- $ query ->select (' * ' )
70+ $ query ->select ($ query -> func ()-> count () )
7171 ->from ('mounts ' )
7272 ->where ($ query ->expr ()->eq ('storage_id ' , $ query ->createNamedParameter ($ storageId )));
73- return $ query ->executeQuery ()->fetchAllAssociative ();
73+ return ( int ) $ query ->executeQuery ()->fetchOne ();
7474 }
7575
7676 /**
@@ -96,12 +96,12 @@ public function testClearFiles(): void {
9696 $ numericStorageId = $ fileInfo ->getStorage ()->getStorageCache ()->getNumericId ();
9797
9898 $ this ->assertCount (1 , $ this ->getFile ($ fileInfo ->getId ()), 'Asserts that file is available ' );
99- $ this ->assertCount (1 , $ this ->getMounts ($ numericStorageId ), 'Asserts that mount is available ' );
99+ $ this ->assertEquals (1 , $ this ->getMountsCount ($ numericStorageId ), 'Asserts that mount is available ' );
100100
101101 $ this ->command ->execute ($ input , $ output );
102102
103103 $ this ->assertCount (1 , $ this ->getFile ($ fileInfo ->getId ()), 'Asserts that file is still available ' );
104- $ this ->assertCount (1 , $ this ->getMounts ($ numericStorageId ), 'Asserts that mount is still available ' );
104+ $ this ->assertEquals (1 , $ this ->getMountsCount ($ numericStorageId ), 'Asserts that mount is still available ' );
105105
106106
107107 $ deletedRows = $ this ->connection ->executeUpdate ('DELETE FROM `*PREFIX*storages` WHERE `id` = ? ' , [$ storageId ]);
@@ -125,7 +125,7 @@ public function testClearFiles(): void {
125125 $ this ->command ->execute ($ input , $ output );
126126
127127 $ this ->assertCount (0 , $ this ->getFile ($ fileInfo ->getId ()), 'Asserts that file gets cleaned up ' );
128- $ this ->assertCount (0 , $ this ->getMounts ($ numericStorageId ), 'Asserts that mount gets cleaned up ' );
128+ $ this ->assertEquals (0 , $ this ->getMountsCount ($ numericStorageId ), 'Asserts that mount gets cleaned up ' );
129129
130130 // Rescan folder to add back to cache before deleting
131131 $ rootFolder ->getUserFolder ($ this ->user1 )->getStorage ()->getScanner ()->scan ('' );
0 commit comments