Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dynamic property creations in test files #33425

Merged
merged 2 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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