Преглед изворни кода

Merge pull request #33425 from nextcloud/fix/fix-dynamic-properties-in-tests

Fix dynamic property creations in test files
Côme Chilliet пре 2 година
родитељ
комит
5cce1dfc60

+ 1 - 1
apps/dav/lib/DAV/Sharing/Backend.php

@@ -179,7 +179,7 @@ class Backend {
 		while ($row = $result->fetch()) {
 			$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
 			$shares[] = [
-				'href' => "principal:${row['principaluri']}",
+				'href' => "principal:{$row['principaluri']}",
 				'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '',
 				'status' => 1,
 				'readOnly' => (int) $row['access'] === self::ACCESS_READ,

+ 9 - 5
apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php

@@ -27,7 +27,6 @@
  */
 namespace OCA\DAV\Tests\unit\CalDAV;
 
-use OC\KnownUser\KnownUserService;
 use OCA\DAV\CalDAV\CalDavBackend;
 use OCA\DAV\CalDAV\Proxy\ProxyMapper;
 use OCA\DAV\Connector\Sabre\Principal;
@@ -41,6 +40,8 @@ use OCP\IUserSession;
 use OCP\L10N\IFactory;
 use OCP\Security\ISecureRandom;
 use OCP\Share\IManager as ShareManager;
+use OC\KnownUser\KnownUserService;
+use PHPUnit\Framework\MockObject\MockObject;
 use Psr\Log\LoggerInterface;
 use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
 use Sabre\DAV\Xml\Property\Href;
@@ -58,15 +59,18 @@ abstract class AbstractCalDavBackend extends TestCase {
 	/** @var CalDavBackend */
 	protected $backend;
 
-	/** @var Principal | \PHPUnit\Framework\MockObject\MockObject */
+	/** @var Principal | MockObject */
 	protected $principal;
-	/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
+	/** @var IUserManager|MockObject */
 	protected $userManager;
-	/** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
+	/** @var IGroupManager|MockObject */
 	protected $groupManager;
-	/** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */
+	/** @var IEventDispatcher|MockObject */
 	protected $dispatcher;
 
+
+	/** @var IConfig | MockObject */
+	private $config;
 	/** @var ISecureRandom */
 	private $random;
 	/** @var LoggerInterface*/

+ 1 - 1
lib/private/Files/Cache/Cache.php

@@ -952,7 +952,7 @@ class Cache implements ICache {
 	 * use the one with the highest id gives the best result with the background scanner, since that is most
 	 * likely the folder where we stopped scanning previously
 	 *
-	 * @return string|bool the path of the folder or false when no folder matched
+	 * @return string|false the path of the folder or false when no folder matched
 	 */
 	public function getIncomplete() {
 		$query = $this->getQueryBuilder();

+ 1 - 1
lib/private/Files/Cache/Wrapper/CacheJail.php

@@ -267,7 +267,7 @@ class CacheJail extends CacheWrapper {
 	 * use the one with the highest id gives the best result with the background scanner, since that is most
 	 * likely the folder where we stopped scanning previously
 	 *
-	 * @return string|bool the path of the folder or false when no folder matched
+	 * @return string|false the path of the folder or false when no folder matched
 	 */
 	public function getIncomplete() {
 		// not supported

+ 1 - 1
lib/private/Files/Cache/Wrapper/CacheWrapper.php

@@ -267,7 +267,7 @@ class CacheWrapper extends Cache {
 	 * use the one with the highest id gives the best result with the background scanner, since that is most
 	 * likely the folder where we stopped scanning previously
 	 *
-	 * @return string|bool the path of the folder or false when no folder matched
+	 * @return string|false the path of the folder or false when no folder matched
 	 */
 	public function getIncomplete() {
 		return $this->getCache()->getIncomplete();

+ 1 - 1
lib/public/Files/Cache/ICache.php

@@ -243,7 +243,7 @@ interface ICache {
 	 * use the one with the highest id gives the best result with the background scanner, since that is most
 	 * likely the folder where we stopped scanning previously
 	 *
-	 * @return string|bool the path of the folder or false when no folder matched
+	 * @return string|false the path of the folder or false when no folder matched
 	 * @since 9.0.0
 	 */
 	public function getIncomplete();

+ 4 - 0
tests/lib/DirectEditing/ManagerTest.php

@@ -105,6 +105,10 @@ class ManagerTest extends TestCase {
 	 * @var MockObject|Folder
 	 */
 	private $userFolder;
+	/**
+	 * @var MockObject|IL10N
+	 */
+	private $l10n;
 	/**
 	 * @var MockObject|IManager
 	 */

+ 5 - 1
tests/lib/Metadata/FileMetadataMapperTest.php

@@ -24,6 +24,7 @@ namespace Test\Metadata;
 
 use OC\Metadata\FileMetadataMapper;
 use OC\Metadata\FileMetadata;
+use PHPUnit\Framework\MockObject\MockObject;
 
 /**
  * @group DB
@@ -33,9 +34,12 @@ class FileMetadataMapperTest extends \Test\TestCase {
 	/** @var IDBConnection */
 	protected $connection;
 
-	/** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
+	/** @var SystemConfig|MockObject */
 	protected $config;
 
+	/** @var FileMetadataMapper|MockObject */
+	protected $mapper;
+
 	protected function setUp(): void {
 		parent::setUp();
 

+ 0 - 1
tests/lib/Repair/RepairMimeTypesTest.php

@@ -36,7 +36,6 @@ class RepairMimeTypesTest extends \Test\TestCase {
 	protected function setUp(): void {
 		parent::setUp();
 
-		$this->savedMimetypeLoader = \OC::$server->getMimeTypeLoader();
 		$this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
 
 		/** @var IConfig | \PHPUnit\Framework\MockObject\MockObject $config */

+ 2 - 0
tests/lib/User/SessionTest.php

@@ -43,6 +43,8 @@ use OC\Security\CSRF\CsrfTokenManager;
 class SessionTest extends \Test\TestCase {
 	/** @var ITimeFactory|MockObject */
 	private $timeFactory;
+	/** @var IProvider|MockObject */
+	private $tokenProvider;
 	/** @var IConfig|MockObject */
 	private $config;
 	/** @var Throttler|MockObject */