Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mailbox name as only numbers #381

Merged
merged 2 commits into from Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -6,7 +6,7 @@ services:
container_name: php-imap
volumes:
- .:/project_orig
command: bash -c "wait-for-it.sh imap.server:993 && cp -dpr /project_orig /project && cd /project && composer install && vendor/bin/phpunit"
command: bash -c "wait-for-it.sh imap.server:993 && cp -dpr /project_orig /project && cd /project && composer install && vendor/bin/phpunit --stop-on-failure"
environment:
- IMAP_SERVER_NAME=imap.server
- IMAP_SERVER_PORT=993
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Expand Up @@ -92,7 +92,7 @@ public function getMailboxes(): array
if (null === $this->mailboxes) {
$this->mailboxes = [];
foreach ($this->mailboxNames as $mailboxName => $mailboxInfo) {
$this->mailboxes[$mailboxName] = $this->getMailbox($mailboxName);
$this->mailboxes[(string) $mailboxName] = $this->getMailbox((string) $mailboxName);
}
}

Expand Down
11 changes: 11 additions & 0 deletions tests/ConnectionTest.php
Expand Up @@ -134,4 +134,15 @@ public function testGetInvalidMailbox()
$this->expectException(MailboxDoesNotExistException::class);
$this->getConnection()->getMailbox('does-not-exist');
}

public function testNumericMailbox()
{
$number = (string) \mt_rand(100, 999);
$conn = $this->getConnection();
$mailbox = $conn->createMailbox($number);

$mailboxes = $conn->getMailboxes();

static::assertArrayHasKey($number, $mailboxes);
}
}