-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Replaced imap with mailhog and refreshed the test. #13197
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
Conversation
45b0a17
to
a6c9cd4
Compare
a6c9cd4
to
aad70ab
Compare
I replaced imap with mailhog and refreshed the test. Since the SDK has not been merged yet, it is temporarily downloading the SDK from my repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine? But I don't really understand email in the first place.
The only reason I was the maintainer for ext/imap was because I did the migration of resource to object
imap | ||
--CONFLICTS-- | ||
imap | ||
curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, all of those tests also require JSON extension (which I know can't be disabled now; but who knows if this will always be the case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I overlooked it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't set json as it cannot be disabled (we actually removed it from EXTENSIONS and skip parts in all tests when to got always enabled).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we actually remove them? I don't really see any harm in having it in the EXTENSIONS section as that section is mainly used for Windows to load shared extensions if available and skip if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah think it got removed from tests. It's not shared extension for Windows either so there is no point to specify it. It's like adding standard or spl there...
we are using mailhog for several years, so please take this as constructive feedback about problems mailhog has:
we want to move to mailpit which is very similar, but seems more maintained and was created by its author mostly because of the above mentioned mailhog problems |
@staabm Yeah, mailhog hasn't been updated in a long time, so my friend recommended mailpit to me. But since these tests are for Windows, I needed to include an executable in the SDK. For now, I am planning to include only the 64-bit version of the executable file in the SDK, but depending on the situation, we may need to add the 32-bit version. I'm sorry if I overlooked it, but the mailpit Windows version executable should only support 64bit. Personally, I am thinking of using mailhog for a while, and if there are no requests for the 32-bit version, I will decide that there is no problem with just the 64-bit version, and then suggest switching to mailpit. |
@SakiTakamachi Just in case you're unaware, the Windows 32-bit build runs on 64-bit Windows. So it seems like there should be no issue using the 64-bit mailpit service in the 32-bit build. Maybe I'm missing some details, I did not follow the conversation. |
@iluuu1994 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions for improvement but it looks good in general.
$c = curl_init(); | ||
curl_setopt($c, CURLOPT_URL, 'http://localhost:8025/api/v2/search?kind=to&query='.$to); | ||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
$res = curl_exec($c); | ||
curl_close($c); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you just use following?
$res = file_get_contents("http://localhost:8025/api/v2/search?kind=to&query=$to");
that would remove unnecessary dependency on curl...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely forgot about it...
return json_decode($res, true); | ||
} | ||
|
||
function getHeaders ($response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we mostly try to follow PSR-12 in tests (not strictly but better not to do space before (
in this case)
$c = curl_init(); | ||
curl_setopt($c, CURLOPT_URL, 'http://localhost:8025/api/v2/messages/'.$id); | ||
curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'DELETE'); | ||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
curl_exec($c); | ||
curl_close($c); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use stream - in this case you will need to also pass stream context to set method
imap | ||
--CONFLICTS-- | ||
imap | ||
curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't set json as it cannot be disabled (we actually removed it from EXTENSIONS and skip parts in all tests when to got always enabled).
$res && | ||
getFromAddress($res) === $from && | ||
getToAddresses($res)[0] === $to && | ||
getSubject($res) === $subject && | ||
getBody($res) === $message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is pretty much repeated everywhere, it might make sense to have a a function in utils for this. Maybe something like:
mailCheckResponse($res, $from, $to, $subject, $message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I'll make it a function.
@@ -113,6 +113,7 @@ curl -sLo hMailServer.exe https://www.hmailserver.com/download_file/?downloadid= | |||
hMailServer.exe /verysilent | |||
cd %APPVEYOR_BUILD_FOLDER% | |||
%PHP_BUILD_DIR%\php.exe -dextension_dir=%PHP_BUILD_DIR% -dextension=com_dotnet appveyor\setup_hmailserver.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably remove this like, right?
The mailpit version has been completed, so it has been closed. |
The original test wasn't very good, so I improved it by the way.