Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
4e63d081
Commit
4e63d081
authored
6 years ago
by
Bryce Lowe
Browse files
Options
Downloads
Patches
Plain Diff
Added test cases for invalid transport method and invalid smtp configuration
parent
0950aac4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/SimpleSAML/Utils/EMailTestCase.php
+31
-0
31 additions, 0 deletions
tests/lib/SimpleSAML/Utils/EMailTestCase.php
with
31 additions
and
0 deletions
tests/lib/SimpleSAML/Utils/EMailTestCase.php
+
31
−
0
View file @
4e63d081
...
@@ -5,6 +5,7 @@ namespace SimpleSAML\Test\Utils;
...
@@ -5,6 +5,7 @@ namespace SimpleSAML\Test\Utils;
use
SimpleSAML\Test\Utils\TestCase
;
use
SimpleSAML\Test\Utils\TestCase
;
use
SimpleSAML\Configuration
;
use
SimpleSAML\Configuration
;
use
SimpleSAML\Utils\Config
;
use
SimpleSAML\Utils\EMail
;
use
SimpleSAML\Utils\EMail
;
/**
/**
...
@@ -71,4 +72,34 @@ class EMailTestCase extends ClearStateTestCase
...
@@ -71,4 +72,34 @@ class EMailTestCase extends ClearStateTestCase
{
{
return
[[
'mailtxt.twig'
],
[
'mailhtml.twig'
]];
return
[[
'mailtxt.twig'
],
[
'mailhtml.twig'
]];
}
}
public
function
testInvalidTransportConfiguration
()
{
// preserve the original configuration
$originalTestConfiguration
=
Configuration
::
getInstance
()
->
toArray
();
// load the configuration with an invalid mail.transport.method
Configuration
::
loadFromArray
(
array_merge
(
$originalTestConfiguration
,
[
'mail.transport.method'
=>
'foobar'
]),
'[ARRAY]'
,
'simplesaml'
);
$this
->
expectException
(
\InvalidArgumentException
::
class
);
new
Email
(
'Test'
,
'phpunit@simplesamlphp.org'
,
'phpunit@simplesamlphp.org'
);
// reset the configuration
Configuration
::
loadFromArray
(
$originalTestConfiguration
,
'[ARRAY]'
,
'simplesaml'
);
}
public
function
testInvalidSMTPConfiguration
()
{
// setup a new email
$email
=
new
Email
(
'Test'
,
'phpunit@simplesamlphp.org'
,
'phpunit@simplesamlphp.org'
);
// set the transport option to smtp but don't set any transport options (invalid state)
// NOTE: this is the same method that the constructor calls, so this should be logically equivalent
// to setting it via the configuration file.
$this
->
expectException
(
\InvalidArgumentException
::
class
);
$email
->
setTransportMethod
(
'smtp'
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment