tests: Avoid using dynamic properties
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -39,6 +39,8 @@ class CommentEventHandlerTest extends TestCase {
|
||||
private $activityManager;
|
||||
/** @var NotificationHelper */
|
||||
private $notificationHelper;
|
||||
/** @var ChangeHelper */
|
||||
private $changeHelper;
|
||||
/** @var CardMapper */
|
||||
private $cardMapper;
|
||||
|
||||
|
||||
@@ -41,10 +41,12 @@ use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||||
|
||||
class DeckProviderTest extends TestCase {
|
||||
|
||||
/** @var DeckProvider */
|
||||
private $provider;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var IURLGenerator|MockObject */
|
||||
private $urlGenerator;
|
||||
|
||||
@@ -57,6 +59,9 @@ class DeckProviderTest extends TestCase {
|
||||
/** @var ICommentsManager|MockObject */
|
||||
private $commentsManager;
|
||||
|
||||
private $l10nFactory;
|
||||
private $config;
|
||||
|
||||
/** @var CardService|MockObject */
|
||||
private $cardService;
|
||||
|
||||
@@ -71,7 +76,6 @@ class DeckProviderTest extends TestCase {
|
||||
$this->commentsManager = $this->createMock(ICommentsManager::class);
|
||||
$this->l10nFactory = $this->createMock(IFactory::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->cardService = $this->createMock(CardService::class);
|
||||
$this->provider = new DeckProvider($this->urlGenerator, $this->activityManager, $this->userManager, $this->commentsManager, $this->l10nFactory, $this->config, $this->userId, $this->cardService);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ class BoardMapperTest extends TestCase {
|
||||
|
||||
/** @var IDBConnection */
|
||||
private $dbConnection;
|
||||
private $labelMapper;
|
||||
/** @var AclMapper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $aclMapper;
|
||||
/** @var BoardMapper */
|
||||
|
||||
@@ -23,18 +23,22 @@
|
||||
|
||||
namespace OCA\Deck\Db;
|
||||
|
||||
class MyRelationalEntity extends RelationalEntity {
|
||||
protected $foo;
|
||||
}
|
||||
|
||||
class RelationalEntityTest extends \Test\TestCase {
|
||||
public function testRelation() {
|
||||
$entity = new RelationalEntity();
|
||||
$entity->foo = null;
|
||||
$entity = new MyRelationalEntity();
|
||||
$entity->setFoo(null);
|
||||
$entity->addRelation('foo');
|
||||
$entity->setFoo('test');
|
||||
$this->assertEquals([], $entity->getUpdatedFields());
|
||||
}
|
||||
|
||||
public function testWithoutRelation() {
|
||||
$entity = new RelationalEntity();
|
||||
$entity->foo = null;
|
||||
$entity = new MyRelationalEntity();
|
||||
$entity->setFoo(null);
|
||||
$entity->setFoo('test');
|
||||
$this->assertEquals(['foo' => true], $entity->getUpdatedFields());
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class ExceptionMiddlewareTest extends \Test\TestCase {
|
||||
private $logger;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
private $request;
|
||||
private $controller;
|
||||
private $exceptionMiddleware;
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@ use OCP\IURLGenerator;
|
||||
use Test\TestCase;
|
||||
|
||||
class CardReferenceProviderTest extends TestCase {
|
||||
private $cardService;
|
||||
private $boardService;
|
||||
private $stackService;
|
||||
private $urlGenerator;
|
||||
private $l10n;
|
||||
private $userId;
|
||||
private $provider;
|
||||
|
||||
public function setUp() : void {
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ class BoardServiceTest extends TestCase {
|
||||
|
||||
/** @var BoardService */
|
||||
private $service;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var L10N */
|
||||
private $l10n;
|
||||
/** @var LabelMapper */
|
||||
|
||||
@@ -42,6 +42,9 @@ use OCP\Share\IManager;
|
||||
|
||||
class PermissionServiceTest extends \Test\TestCase {
|
||||
|
||||
/** @var IRequest */
|
||||
private $request;
|
||||
private $circlesService;
|
||||
/** @var PermissionService*/
|
||||
private $service;
|
||||
/** @var ILogger */
|
||||
|
||||
@@ -31,6 +31,7 @@ use OCP\IRequest;
|
||||
|
||||
class BoardApiControllerTest extends \Test\TestCase {
|
||||
private $appName = 'deck';
|
||||
private $request;
|
||||
private $userId = 'admin';
|
||||
private $controller;
|
||||
private $boardService;
|
||||
|
||||
@@ -28,6 +28,7 @@ use OCA\Deck\Db\Board;
|
||||
use OCP\IUser;
|
||||
|
||||
class BoardControllerTest extends \Test\TestCase {
|
||||
private $l10n;
|
||||
private $controller;
|
||||
private $request;
|
||||
private $userManager;
|
||||
|
||||
@@ -30,6 +30,7 @@ use OCP\IRequest;
|
||||
|
||||
class BoardImportApiControllerTest extends \Test\TestCase {
|
||||
private $appName = 'deck';
|
||||
private $request;
|
||||
private $userId = 'admin';
|
||||
/** @var BoardImportApiController */
|
||||
private $controller;
|
||||
|
||||
@@ -32,6 +32,7 @@ use OCP\IRequest;
|
||||
|
||||
class StackApiControllerTest extends \Test\TestCase {
|
||||
private $appName = 'deck';
|
||||
private $request;
|
||||
private $userId = 'admin';
|
||||
private $controller;
|
||||
private $boardService;
|
||||
|
||||
Reference in New Issue
Block a user