Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Infrastructure/ActivesyncTest.php
Show All 32 Lines | class ActivesyncTest extends TestCase | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
if (!self::$user) { | |||||
self::$user = $this->getTestUser('activesynctest@kolab.org', ['password' => 'simple123'], true); | |||||
} | |||||
if (!self::$deviceId) { | if (!self::$deviceId) { | ||||
// By always creating a new device we force syncroton to initialize. | // By always creating a new device we force syncroton to initialize. | ||||
// Otherwise we work against uninitialized metadata (subscription states), | // Otherwise we work against uninitialized metadata (subscription states), | ||||
// because the account has been removed, but syncroton doesn't reinitalize the metadata for known devices. | // because the account has been removed, but syncroton doesn't reinitalize the metadata for known devices. | ||||
self::$deviceId = (string) Str::uuid(); | self::$deviceId = (string) Str::uuid(); | ||||
} | } | ||||
$deviceId = self::$deviceId; | |||||
\config(['imap.default_folders' => [ | |||||
'Drafts' => [ | |||||
'metadata' => [ | |||||
'/private/vendor/kolab/folder-type' => 'mail.drafts', | |||||
'/private/vendor/kolab/activesync' => "{\"FOLDER\":{\"{$deviceId}\":{\"S\":1}}}" | |||||
], | |||||
], | |||||
'Calendar' => [ | |||||
'metadata' => [ | |||||
'/private/vendor/kolab/folder-type' => 'event.default', | |||||
'/private/vendor/kolab/activesync' => "{\"FOLDER\":{\"{$deviceId}\":{\"S\":1}}}" | |||||
], | |||||
], | |||||
'Contacts' => [ | |||||
'metadata' => [ | |||||
'/private/vendor/kolab/folder-type' => 'contact.default', | |||||
'/private/vendor/kolab/activesync' => "{\"FOLDER\":{\"{$deviceId}\":{\"S\":1}}}" | |||||
], | |||||
], | |||||
]]); | |||||
if (!self::$user) { | |||||
self::$user = $this->getTestUser('activesynctest@kolab.org', ['password' => 'simple123'], true); | |||||
} | |||||
if (!self::$client) { | if (!self::$client) { | ||||
self::$client = new \GuzzleHttp\Client([ | self::$client = new \GuzzleHttp\Client([ | ||||
'http_errors' => false, // No exceptions | 'http_errors' => false, // No exceptions | ||||
'base_uri' => \config("services.activesync.uri"), | 'base_uri' => \config("services.activesync.uri"), | ||||
'verify' => false, | 'verify' => false, | ||||
'auth' => [self::$user->email, 'simple123'], | 'auth' => [self::$user->email, 'simple123'], | ||||
'connect_timeout' => 10, | 'connect_timeout' => 10, | ||||
'timeout' => 10, | 'timeout' => 10, | ||||
Show All 40 Lines | public function testList() | ||||
$this->assertEquals(200, $response->getStatusCode()); | $this->assertEquals(200, $response->getStatusCode()); | ||||
$dom = self::fromWbxml($response->getBody()); | $dom = self::fromWbxml($response->getBody()); | ||||
$xml = $dom->saveXML(); | $xml = $dom->saveXML(); | ||||
$this->assertStringContainsString('INBOX', $xml); | $this->assertStringContainsString('INBOX', $xml); | ||||
// The hash is based on the name, so it's always the same | // The hash is based on the name, so it's always the same | ||||
$inboxId = '38b950ebd62cd9a66929c89615d0fc04'; | $inboxId = '38b950ebd62cd9a66929c89615d0fc04'; | ||||
$this->assertStringContainsString($inboxId, $xml); | $this->assertStringContainsString($inboxId, $xml); | ||||
//TODO for this to work we need to create the default folders in IMAP::createUser | $this->assertStringContainsString('Drafts', $xml); | ||||
// $this->assertStringContainsString('Drafts', $result); | $this->assertStringContainsString('Calendar', $xml); | ||||
machniak: What about Drafts? | |||||
// $this->assertStringContainsString('Sent', $result); | $this->assertStringContainsString('Contacts', $xml); | ||||
// $this->assertStringContainsString('Trash', $result); | |||||
// $this->assertStringContainsString('Calendar', $result); | |||||
// $this->assertStringContainsString('Contacts', $result); | |||||
// Find the inbox for the next step | // Find the inbox for the next step | ||||
// $collectionIds = $dom->getElementsByTagName('ServerId'); | // $collectionIds = $dom->getElementsByTagName('ServerId'); | ||||
// $inboxId = $collectionIds[0]->nodeValue; | // $inboxId = $collectionIds[0]->nodeValue; | ||||
return $inboxId; | return $inboxId; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |
What about Drafts?