@@ -91,7 +91,9 @@ class ActivityManagerTest extends TestCase {
|
||||
$managerClass = new \ReflectionClass(ActivityManager::class);
|
||||
$this->l10n->expects($this->any())
|
||||
->method('t')
|
||||
->will($this->returnCallback(function ($s) { return $s; }));
|
||||
->will($this->returnCallback(function ($s) {
|
||||
return $s;
|
||||
}));
|
||||
|
||||
foreach ($managerClass->getConstants() as $constant => $value) {
|
||||
if (strpos($constant, 'SUBJECT') === 0) {
|
||||
@@ -111,7 +113,6 @@ class ActivityManagerTest extends TestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testCreateEvent() {
|
||||
@@ -342,12 +343,10 @@ class ActivityManagerTest extends TestCase {
|
||||
], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [777]));
|
||||
}
|
||||
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = array())
|
||||
{
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = []) {
|
||||
$reflection = new \ReflectionClass(get_class($object));
|
||||
$method = $reflection->getMethod($methodName);
|
||||
$method->setAccessible(true);
|
||||
return $method->invokeArgs($object, $parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@ namespace OCA\Deck\Activity;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
||||
class ChangeSetTest extends TestCase {
|
||||
|
||||
public function setUp(): void {
|
||||
}
|
||||
|
||||
@@ -54,5 +52,4 @@ class ChangeSetTest extends TestCase {
|
||||
$changeSet->enableDiff();
|
||||
$this->assertTrue($changeSet->getDiff());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,27 +23,12 @@
|
||||
|
||||
namespace OCA\Deck\Activity;
|
||||
|
||||
use OCA\Deck\Db\AclMapper;
|
||||
use OCA\Deck\Db\AssignedUsers;
|
||||
use OCA\Deck\Db\Attachment;
|
||||
use OCA\Deck\Db\AttachmentMapper;
|
||||
use OCA\Deck\Db\Board;
|
||||
use OCA\Deck\Db\BoardMapper;
|
||||
use OCA\Deck\Db\Card;
|
||||
use OCA\Deck\Db\CardMapper;
|
||||
use OCA\Deck\Db\Label;
|
||||
use OCA\Deck\Db\Stack;
|
||||
use OCA\Deck\Db\StackMapper;
|
||||
use OCA\Deck\Notification\NotificationHelper;
|
||||
use OCA\Deck\Service\PermissionService;
|
||||
use OCP\Activity\IEvent;
|
||||
use OCP\Activity\IManager;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
use OCP\IL10N;
|
||||
use OCP\IUser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||||
|
||||
class CommentEventHandlerTest extends TestCase {
|
||||
|
||||
@@ -109,12 +94,10 @@ class CommentEventHandlerTest extends TestCase {
|
||||
$this->commentEventHandler->handle($commentsEvent);
|
||||
}
|
||||
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = array())
|
||||
{
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = []) {
|
||||
$reflection = new \ReflectionClass(get_class($object));
|
||||
$method = $reflection->getMethod($methodName);
|
||||
$method->setAccessible(true);
|
||||
return $method->invokeArgs($object, $parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,20 +81,20 @@ class DeckProviderTest extends TestCase {
|
||||
$event->expects($this->any())->method('getObjectName')->willReturn($objectName);
|
||||
$event->expects($this->any())->method('getAuthor')->willReturn('admin');
|
||||
$event->expects($this->any())->method('getMessage')->willReturn('');
|
||||
$event->expects($this->any())->method('setIcon')->will($this->returnCallback(function($icon) use (&$data, $event) {
|
||||
$event->expects($this->any())->method('setIcon')->will($this->returnCallback(function ($icon) use (&$data, $event) {
|
||||
$data['icon'] = $icon;
|
||||
return $event;
|
||||
}));
|
||||
$event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function($subject) use (&$data, $event) {
|
||||
$event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
|
||||
$data['parsedSubject'] = $subject;
|
||||
return $event;
|
||||
}));
|
||||
$event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function($subject) use (&$data, $event) {
|
||||
$event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
|
||||
$data['richSubject'] = $subject;
|
||||
return $event;
|
||||
}));
|
||||
$event->expects($this->any())->method('getIcon')->will(
|
||||
$this->returnCallback(function() use (&$data) {
|
||||
$this->returnCallback(function () use (&$data) {
|
||||
return array_key_exists('icon', $data) ? $data['icon'] : 'noicon';
|
||||
})
|
||||
);
|
||||
@@ -133,12 +133,12 @@ class DeckProviderTest extends TestCase {
|
||||
->willReturn('test string {board}');
|
||||
$this->urlGenerator->expects($this->any())
|
||||
->method('imagePath')
|
||||
->will($this->returnCallback(function($a, $i) {
|
||||
->will($this->returnCallback(function ($a, $i) {
|
||||
return $a . '/' . $i;
|
||||
}));
|
||||
$this->urlGenerator->expects($this->any())
|
||||
->method('getAbsoluteURL')
|
||||
->will($this->returnCallback(function($url) {
|
||||
->will($this->returnCallback(function ($url) {
|
||||
return $url;
|
||||
}));
|
||||
$this->provider->parse('en_US', $event);
|
||||
@@ -159,7 +159,7 @@ class DeckProviderTest extends TestCase {
|
||||
public function testParseObjectTypeBoard() {
|
||||
$this->urlGenerator->expects($this->any())
|
||||
->method('imagePath')
|
||||
->will($this->returnCallback(function($a, $i) {
|
||||
->will($this->returnCallback(function ($a, $i) {
|
||||
return $a . '/' . $i;
|
||||
}));
|
||||
$this->activityManager->expects($this->once())
|
||||
@@ -200,7 +200,7 @@ class DeckProviderTest extends TestCase {
|
||||
public function testParseObjectTypeCard() {
|
||||
$this->urlGenerator->expects($this->any())
|
||||
->method('imagePath')
|
||||
->will($this->returnCallback(function($a, $i) {
|
||||
->will($this->returnCallback(function ($a, $i) {
|
||||
return $a . '/' . $i;
|
||||
}));
|
||||
$this->activityManager->expects($this->once())
|
||||
@@ -238,13 +238,12 @@ class DeckProviderTest extends TestCase {
|
||||
$this->assertEquals('test string Card', $event->getParsedSubject());
|
||||
$this->assertEquals('test string {card}', $event->getRichSubject());
|
||||
$this->assertEquals('', $event->getMessage());
|
||||
|
||||
}
|
||||
|
||||
public function testParseObjectTypeCardWithDiff() {
|
||||
$this->urlGenerator->expects($this->any())
|
||||
->method('imagePath')
|
||||
->will($this->returnCallback(function($a, $i) {
|
||||
->will($this->returnCallback(function ($a, $i) {
|
||||
return $a . '/' . $i;
|
||||
}));
|
||||
$this->activityManager->expects($this->once())
|
||||
@@ -496,8 +495,7 @@ class DeckProviderTest extends TestCase {
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = array())
|
||||
{
|
||||
public function invokePrivate(&$object, $methodName, array $parameters = []) {
|
||||
$reflection = new \ReflectionClass(get_class($object));
|
||||
$method = $reflection->getMethod($methodName);
|
||||
$method->setAccessible(true);
|
||||
|
||||
@@ -77,5 +77,4 @@ class FilterTest extends TestCase {
|
||||
public function testAllowedApps() {
|
||||
$this->assertEquals(['deck'], $this->filter->allowedApps());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ class SettingTest extends TestCase {
|
||||
|
||||
public function setUp(): void {
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) { return $s; }));
|
||||
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) {
|
||||
return $s;
|
||||
}));
|
||||
$this->setting = new Setting($this->l10n);
|
||||
}
|
||||
|
||||
@@ -66,5 +68,4 @@ class SettingTest extends TestCase {
|
||||
public function testIsDefaultEnabledMail() {
|
||||
$this->assertFalse($this->setting->isDefaultEnabledMail());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user