Skip to content

POP3 XOAUTH2 support for Microsoft#199

Closed
griesi007 wants to merge 10 commits intolaminas:2.17.xfrom
griesi007:2.17.x
Closed

POP3 XOAUTH2 support for Microsoft#199
griesi007 wants to merge 10 commits intolaminas:2.17.xfrom
griesi007:2.17.x

Conversation

@griesi007
Copy link
Copy Markdown

Add support for Microsoft POP3 via modern authentication

Usage:
$storage = new \Laminas\Mail\Storage\Pop3Pop3(\Laminas\Mail\Protocol\Pop3\Xoauth2\Microsoft::fromParams([ 'host' => 'Outlook.office365.com', 'targetMailbox' => 'test@contoso.onmicrosoft.com', 'accessToken' => '###ACCÈSSTOKEN###', ]));

Christian Ebert added 7 commits July 28, 2022 10:32
Signed-off-by: griesi007 <github@12live.de>
Signed-off-by: griesi007 <github@12live.de>
Signed-off-by: griesi007 <github@12live.de>
Signed-off-by: griesi007 <github@12live.de>
@Ocramius Ocramius added this to the 2.17.0 milestone Jul 28, 2022
Signed-off-by: griesi007 <github@12live.de>
Comment thread src/Protocol/Pop3/Response.php Outdated
use Laminas\Mail\Protocol\Exception\RuntimeException;
use Laminas\Mail\Storage\ParamsNormalizer;

class Microsoft extends \Laminas\Mail\Protocol\Pop3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docblock is needed here, documentation inside the repo also needs to mention the existence of this protocol

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class requires unit/integration testing.

Not sure if integration testing is viable though, because it would require a mock Microsoft POP3 server 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius UnitTests for static function fromParams? Rest of the class are private methods or methods heavily relying on the base class POP3 which itself is completely untested as far as I can see. I am not that experienced with unit testing so not really an idea where to start and where to end. Probably I am not able to introduce Unit Test for the base class

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing this specific class would suffice: look at existing tests as a start.

For running them:

  1. composer install
  2. ./vendor/bin/phpunit

If you have no experience, this is the perfect occasion to get started: no code lands without appropriate test coverage here, so it's an unavoidable roadblock. Once you learned it, you will likely start adopting it yourself too 👍

Copy link
Copy Markdown
Author

@griesi007 griesi007 Jul 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius Sorry but I do not have an idea how to test this class beeing so heavily bound to sockets and more stuff by the underlying base class which cannot easily replaced by mocks or stubs because of missing DI principles. Anyhow without any help you can just sadly delete this pull reqeust

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave you an initial starting point: can't really tutor step by step.

Push what you have, see if anyone else can help? You can also ask on our slack for help 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can.´t do more here. Pushed with all the other issues fixed. If this is not acceptable just reject the pull request

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not acceptable just reject the pull request

Will reject then: yes, testing is required for any patches sent, even if hard to do.

laminas/laminas-mail has the architecture it has: can't change that without breaking a lot of downstream projects, but automated testing should be performed nonetheless, since we are otherwise blind to regressions, incompatibilities during upgrades, and it just ends up being more work on the maintainer's plate.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius I agree that testing is vital. In my Opionion the class is untestable as long as the base class is not refactored accordingly. I can live with my imlpementation not beeing integrated but it´s really annoying that I spent a lot of time to do my best to give back to the community with such an outcome.

Copy link
Copy Markdown
Member

@Ocramius Ocramius Jul 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent a lot of time to do my best to give back to the community with such an outcome.

I did propose that you'd invest more time into it, but that's your decision. I already ranted about time yesterday, from my end: https://twitter.com/Ocramius/status/1551907387262500865

I'm actually more worried that you "stopped trying" after finding the first roadblock, when I made it clear relatively early ( >2h ago) that testing would be mandatory regardless of implementation.

the class is untestable as long as the base class is not refactored accordingly.

an integration test would have sufficed, and yes, complex.

Comment thread src/Protocol/Pop3/Xoauth2/Microsoft.php
Christian Ebert added 2 commits July 28, 2022 11:34
Signed-off-by: griesi007 <github@12live.de>
Signed-off-by: griesi007 <github@12live.de>
@Ocramius
Copy link
Copy Markdown
Member

Closing as Won't fix as per #199 (comment)

@Ocramius Ocramius closed this Jul 28, 2022
@Ocramius Ocramius self-assigned this Jul 28, 2022
@Ocramius Ocramius added the Won't Fix This will not be worked on label Jul 28, 2022
@Ocramius Ocramius removed this from the 2.17.0 milestone Jul 28, 2022
@Ocramius Ocramius mentioned this pull request Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Won't Fix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants