diff --git a/lib/Db/MailAccount.php b/lib/Db/MailAccount.php index 3744b1414a..c7470eda44 100644 --- a/lib/Db/MailAccount.php +++ b/lib/Db/MailAccount.php @@ -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() diff --git a/tests/Integration/Db/MailAccountMapperTest.php b/tests/Integration/Db/MailAccountMapperTest.php index ab78297db8..322432b0c0 100644 --- a/tests/Integration/Db/MailAccountMapperTest.php +++ b/tests/Integration/Db/MailAccountMapperTest.php @@ -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; @@ -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()); + } }