Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Backends/IMAPTest.php
<?php | <?php | ||||
namespace Tests\Feature\Backends; | namespace Tests\Feature\Backends; | ||||
use App\Backends\IMAP; | use App\Backends\IMAP; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class IMAPTest extends TestCase | class IMAPTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* Test verifying IMAP account existence (existing account) | * Test verifying IMAP account existence (existing account) | ||||
* | * | ||||
* @group imap | * @group imap | ||||
*/ | */ | ||||
public function testVerifyAccountExisting(): void | public function testVerifyAccountExisting(): void | ||||
{ | { | ||||
// existing user | |||||
$result = IMAP::verifyAccount('john@kolab.org'); | $result = IMAP::verifyAccount('john@kolab.org'); | ||||
$this->assertTrue($result); | |||||
// TODO: Mocking rcube_imap_generic is not that nice, | // non-existing user | ||||
// Find a way to be sure some testing account has folders | |||||
// initialized, and some other not, so we can make assertions | |||||
// on the verifyAccount() result | |||||
$this->markTestIncomplete(); | |||||
} | |||||
/** | |||||
* Test verifying IMAP account existence (non-existing account) | |||||
* | |||||
* @group imap | |||||
*/ | |||||
public function testVerifyAccountNonExisting(): void | |||||
{ | |||||
$this->expectException(\Exception::class); | $this->expectException(\Exception::class); | ||||
IMAP::verifyAccount('non-existing@domain.tld'); | IMAP::verifyAccount('non-existing@domain.tld'); | ||||
} | } | ||||
/** | /** | ||||
* Test verifying IMAP shared folder existence | * Test verifying IMAP shared folder existence | ||||
* | * | ||||
* @group imap | * @group imap | ||||
*/ | */ | ||||
public function testVerifySharedFolder(): void | public function testVerifySharedFolder(): void | ||||
{ | { | ||||
// non-existing | |||||
$result = IMAP::verifySharedFolder('shared/Resources/UnknownResource@kolab.org'); | $result = IMAP::verifySharedFolder('shared/Resources/UnknownResource@kolab.org'); | ||||
$this->assertFalse($result); | $this->assertFalse($result); | ||||
// TODO: Test with an existing shared folder | // existing | ||||
$this->markTestIncomplete(); | $result = IMAP::verifySharedFolder('shared/Calendar@kolab.org'); | ||||
$this->assertTrue($result); | |||||
} | } | ||||
} | } |