Skip to content

Commit

Permalink
feat: mail provider backend
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <[email protected]>
  • Loading branch information
SebastianKrupinski committed Aug 30, 2024
1 parent cd40204 commit ed78517
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 30 deletions.
1 change: 0 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public function register(IRegistrationContext $context): void {
}

// Added in version 4.0.0
// register mail provider
$context->registerMailProvider(MailProvider::class);

$context->registerNotifierService(Notifier::class);
Expand Down
2 changes: 0 additions & 2 deletions lib/Db/MailAccountMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ public function findByUserId(string $userId): array {
* @param string $address mail address (e.g. [email protected])
*
* @return MailAccount[]
*
* @throws DoesNotExistException
*/
public function findByUserIdAndAddress(string $userId, string $address): array {
$qb = $this->db->getQueryBuilder();
Expand Down
4 changes: 2 additions & 2 deletions lib/Provider/Command/MessageSend.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function __construct(
* @param array $options array of options reserved for future use
*
* @return LocalMessage
*
*
* @throws SendException on failure, check message for reason
*
*
*/
public function perform(string $userId, string $serviceId, IMessage $message, array $options = []): LocalMessage {
// find user mail account details
Expand Down
1 change: 0 additions & 1 deletion lib/Provider/MailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public function listServices(string $userId): array {
$services = [];
// add services to collection
foreach ($accounts as $entry) {
// add service to collection
$services[(string)$entry->getId()] = $this->serviceFromAccount($userId, $entry);
}
// return list of services for user
Expand Down
19 changes: 7 additions & 12 deletions tests/Unit/Provider/Command/MessageSendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@
use OCP\Mail\Provider\Attachment;
use OCP\Mail\Provider\Exception\SendException;
use OCP\Mail\Provider\Message;
use PHPUnit\Framework\MockObject\MockObject;

class MessageSendTest extends TestCase {

/** @var IConfig&MockObject */
private $config;
/** @var ITimeFactory&MockObject */
private $time;
/** @var AccountService&MockObject */
private $accountService;
/** @var OutboxService&MockObject */
private $outboxService;
/** @var AttachmentService&MockObject */
private $attachmentService;
/** @var MessageSend */

private IConfig&MockObject $config;
private ITimeFactory&MockObject $time;
private AccountService&MockObject $accountService;
private OutboxService&MockObject $outboxService;
private AttachmentService&MockObject $attachmentService;
private $commandSend;

protected function setUp(): void {
Expand Down
13 changes: 5 additions & 8 deletions tests/Unit/Provider/MailProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@
use OCA\Mail\Service\AccountService;
use OCP\IL10N;
use OCP\Mail\Provider\Address as MailAddress;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

class MailProviderTest extends TestCase {

/** @var ContainerInterface&MockObject */
private $containerInterface;
/** @var AccountService&MockObject */
private $accountService;
/** @var LoggerInterface */
private $logger;
/** @var IL10N&MockObject */
private $l10n;
private ContainerInterface&MockObject $containerInterface;
private AccountService&MockObject $accountService;
private LoggerInterface $logger;
private IL10N&MockObject $l10n;

protected function setUp(): void {
parent::setUp();
Expand Down
7 changes: 3 additions & 4 deletions tests/Unit/Provider/MailServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
use Psr\Container\ContainerInterface;

class MailServiceTest extends TestCase {
/** @var MailService */
private $mailService;
/** @var Address */
private $primaryAddress;

private MailService $mailService;
private Address $primaryAddress;

protected function setUp(): void {
parent::setUp();
Expand Down

0 comments on commit ed78517

Please sign in to comment.