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