Skip to content

Commit

Permalink
test: Add tests for Events
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Sep 20, 2024
1 parent 64357f8 commit df16256
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Event/GroupVersionsExpireDeleteFileEventTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GroupFolders\Tests\AppInfo;

use OCA\GroupFolders\Event\GroupVersionsExpireDeleteFileEvent;
use Test\TestCase;

class GroupVersionsExpireDeleteFileEventTest extends TestCase {
public function testProperties(): void {
$event = new GroupVersionsExpireDeleteFileEvent(123);
$this->assertEquals(123, $event->fileId);
}
}
27 changes: 27 additions & 0 deletions tests/Event/GroupVersionsExpireDeleteVersionEventTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GroupFolders\Tests\AppInfo;

use OCA\GroupFolders\Event\GroupVersionsExpireDeleteVersionEvent;
use OCA\GroupFolders\Versions\GroupVersion;
use Test\TestCase;

class GroupVersionsExpireDeleteVersionEventTest extends TestCase {
public function testProperties(): void {
$version = $this->createMock(GroupVersion::class);
$version
->expects($this->once())
->method('getFolderId')
->willReturn(123);

$event = new GroupVersionsExpireDeleteVersionEvent($version);
$this->assertEquals(123, $event->version->getFolderId());
}
}
20 changes: 20 additions & 0 deletions tests/Event/GroupVersionsExpireEnterFolderEventTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GroupFolders\Tests\AppInfo;

use OCA\GroupFolders\Event\GroupVersionsExpireEnterFolderEvent;
use Test\TestCase;

class GroupVersionsExpireEnterFolderEventTest extends TestCase {
public function testProperties(): void {
$event = new GroupVersionsExpireEnterFolderEvent(['key' => 'value']);
$this->assertEquals(['key' => 'value'], $event->folder);
}
}

0 comments on commit df16256

Please sign in to comment.