Skip to content

Commit

Permalink
fixup! fix(provisioning): Clean up orphaned accounts
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Oct 27, 2023
1 parent e8bc53e commit ce48a7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Db/MailAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* @method string getEditorMode()
* @method void setEditorMode(string $editorMode)
* @method int|null getProvisioningId()
* @method void setProvisioningId(int $provisioningId)
* @method void setProvisioningId(int|null $provisioningId)
* @method int getOrder()
* @method void setOrder(int $order)
* @method bool|null getShowSubscribedOnly()
Expand Down
13 changes: 13 additions & 0 deletions tests/Integration/Db/MailAccountMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
use OC;
use OCA\Mail\Db\MailAccount;
use OCA\Mail\Db\MailAccountMapper;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IDBConnection;
use function random_int;

/**
* @group DB
* @covers \OCA\Mail\Db\MailAccountMapper
*/
class MailAccountMapperTest extends TestCase {
use DatabaseTransaction;
Expand Down Expand Up @@ -106,4 +109,14 @@ public function testSave() {
$this->assertNotNull($b->getId());
$this->assertEquals($b->getId(), $c->getId());
}

public function testDeleteProvisionedOrphans(): void {
$this->account->setProvisioningId(random_int(1, 10000));
$this->mapper->insert($this->account);

$this->mapper->deleteProvisionedOrphanAccounts();

$this->expectException(DoesNotExistException::class);
$this->mapper->findById($this->account->getId());
}
}

0 comments on commit ce48a7e

Please sign in to comment.