Browse Source

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

Fix dynamic property creations in test files
tags/v25.0.0beta1
Côme Chilliet 1 year ago
parent
commit
5cce1dfc60
No account linked to committer's email address

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

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 */

Loading…
Cancel
Save