added event for recent activities (#2254)

This commit is contained in:
Kevin Papst
2021-01-11 19:13:14 +01:00
committed by GitHub
parent 1de6b5d385
commit cb6924e6d6
7 changed files with 180 additions and 17 deletions

View File

@@ -26,19 +26,41 @@ class CalendarDragAndDropSourceEventTest extends TestCase
$sut = new CalendarDragAndDropSourceEvent($user);
$hello = new TestDragAndDropSource('hello');
$tmp1 = new TestDragAndDropSource('foo');
$tmp2 = new TestDragAndDropSource('bar');
$tmp3 = new TestDragAndDropSource('hello');
self::assertSame($user, $sut->getUser());
self::assertIsArray($sut->getSources());
self::assertEmpty($sut->getSources());
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource(new TestDragAndDropSource()));
self::assertCount(1, $sut->getSources());
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource($tmp1));
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource($tmp2));
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource($hello));
self::assertInstanceOf(CalendarDragAndDropSourceEvent::class, $sut->addSource($tmp3));
self::assertCount(4, $sut->getSources());
self::assertEquals([$tmp1, $tmp2, $hello, $tmp3], $sut->getSources());
self::assertFalse($sut->removeSource(new TestDragAndDropSource('foo')));
self::assertTrue($sut->removeSource($hello));
self::assertFalse($sut->removeSource(new TestDragAndDropSource('world')));
self::assertCount(3, $sut->getSources());
self::assertEquals([$tmp1, $tmp2, $tmp3], $sut->getSources());
}
}
class TestDragAndDropSource implements DragAndDropSource
{
private $title;
public function __construct(string $title)
{
$this->title = $title;
}
public function getTitle(): string
{
return '';
return $this->title;
}
public function getRoute(): string