Skip to content

Commit

Permalink
Merge pull request #33425 from nextcloud/fix/fix-dynamic-properties-i…
Browse files Browse the repository at this point in the history
…n-tests

Fix dynamic property creations in test files
  • Loading branch information
come-nc authored Aug 2, 2022
2 parents 6aec09e + 7ae6791 commit 5cce1df
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/Sharing/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function getShares(int $resourceId): array {
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,
Expand Down
14 changes: 9 additions & 5 deletions apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,6 +40,8 @@
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;
Expand All @@ -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*/
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ public function getAll() {
* 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();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getAll() {
* 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
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Wrapper/CacheWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getAll() {
* 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();
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/Cache/ICache.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function searchQuery(ISearchQuery $query);
* 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();
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/DirectEditing/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class ManagerTest extends TestCase {
* @var MockObject|Folder
*/
private $userFolder;
/**
* @var MockObject|IL10N
*/
private $l10n;
/**
* @var MockObject|IManager
*/
Expand Down
6 changes: 5 additions & 1 deletion tests/lib/Metadata/FileMetadataMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use OC\Metadata\FileMetadataMapper;
use OC\Metadata\FileMetadata;
use PHPUnit\Framework\MockObject\MockObject;

/**
* @group DB
Expand All @@ -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();

Expand Down
1 change: 0 additions & 1 deletion tests/lib/Repair/RepairMimeTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/User/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
class SessionTest extends \Test\TestCase {
/** @var ITimeFactory|MockObject */
private $timeFactory;
/** @var IProvider|MockObject */
private $tokenProvider;
/** @var IConfig|MockObject */
private $config;
/** @var Throttler|MockObject */
Expand Down

0 comments on commit 5cce1df

Please sign in to comment.