Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485201
AutodiscoverTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
AutodiscoverTest.php
View Options
<?php
namespace
Tests\Infrastructure
;
use
Tests\TestCase
;
class
AutodiscoverTest
extends
TestCase
{
private
static
?
\GuzzleHttp\Client
$client
=
null
;
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
if
(!
self
::
$client
)
{
self
::
$client
=
new
\GuzzleHttp\Client
([
'http_errors'
=>
false
,
// No exceptions
'base_uri'
=>
"http://roundcube/"
,
'verify'
=>
false
,
'connect_timeout'
=>
10
,
'timeout'
=>
10
,
]);
}
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
parent
::
tearDown
();
}
public
function
testWellKnownOutlook
()
{
$body
=
<<<
EOF
<
Autodiscover
xmlns
=
"http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"
>
<
Request
>
<
EMailAddress
>
admin
@
example
.
local
</
EMailAddress
>
<
AcceptableResponseSchema
>
http
://
schemas
.
microsoft
.
com
/
exchange
/
autodiscover
/
outlook
/
responseschema
/
2006
a
</
AcceptableResponseSchema
>
</
Request
>
</
Autodiscover
>
EOF
;
$response
=
self
::
$client
->
request
(
'POST'
,
'autodiscover/autodiscover.xml'
,
[
'headers'
=>
[
"Content-Type"
=>
"text/xml; charset=utf-8"
],
'body'
=>
$body
]);
$this
->
assertEquals
(
$response
->
getStatusCode
(),
200
);
$data
=
$response
->
getBody
();
$this
->
assertTrue
(
str_contains
(
$data
,
'<Server>example.local</Server>'
));
$this
->
assertTrue
(
str_contains
(
$data
,
'admin@example.local'
));
}
public
function
testWellKnownActivesync
()
{
$body
=
<<<
EOF
<
Autodiscover
xmlns
=
"http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006"
>
<
Request
>
<
EMailAddress
>
admin
@
example
.
local
</
EMailAddress
>
<
AcceptableResponseSchema
>
http
://
schemas
.
microsoft
.
com
/
exchange
/
autodiscover
/
mobilesync
/
responseschema
/
2006
</
AcceptableResponseSchema
>
</
Request
>
</
Autodiscover
>
EOF
;
$response
=
self
::
$client
->
request
(
'POST'
,
'autodiscover/autodiscover.xml'
,
[
'headers'
=>
[
"Content-Type"
=>
"text/xml; charset=utf-8"
],
'body'
=>
$body
]);
$this
->
assertEquals
(
$response
->
getStatusCode
(),
200
);
$data
=
$response
->
getBody
();
$this
->
assertTrue
(
str_contains
(
$data
,
'<Url>https://example.local/Microsoft-Server-ActiveSync</Url>'
));
$this
->
assertTrue
(
str_contains
(
$data
,
'admin@example.local'
));
}
public
function
testWellKnownMail
()
{
$response
=
self
::
$client
->
request
(
'GET'
,
'.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=fred@example.com'
);
$this
->
assertEquals
(
$response
->
getStatusCode
(),
200
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 7:13 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387416
Default Alt Text
AutodiscoverTest.php (2 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment