StubControllerComponentsFactory
Attributes
- Graph
-
- Supertypes
-
trait StubMessagesFactorytrait StubBodyParserFactoryclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object Helpers.type
Members list
Value members
Concrete methods
Create a minimal controller components, useful for unit testing.
Create a minimal controller components, useful for unit testing.
In most cases, you'll want the standard defaults:
val controller = new MyController(stubControllerComponents())
A custom body parser can be used with bodyParser() to provide a request body to the controller:
val cc = stubControllerComponents(bodyParser(AnyContent("request body text")))
Value parameters
- bodyParser
-
the body parser used to parse any content, stubBodyParser(AnyContentAsEmpty) by default.
- executionContext
-
an execution context, defaults to ExecutionContext.global
- fileMimeTypes
-
the mime type associated with file extensions, new DefaultFileMimeTypes(FileMimeTypesConfiguration() by default.
- langs
-
the langs instance for messaging, new DefaultLangs() by default.
- messagesApi
-
the messages api, new DefaultMessagesApi() by default.
- playBodyParsers
-
the playbodyparsers, defaults to stubPlayBodyParsers(NoMaterializer)
Attributes
- Returns
-
a fully configured ControllerComponents instance.
Inherited methods
Stub method that returns the content immediately. Useful for unit testing.
Stub method that returns the content immediately. Useful for unit testing.
val stubParser = bodyParser(AnyContent("hello"))
Value parameters
- content
-
the content to return, AnyContentAsEmpty by default
Attributes
- Returns
-
a BodyParser for type T that returns Accumulator.done(Right(content))
- Inherited from:
- StubBodyParserFactory
Value parameters
- availables
-
default as Seq(Lang.defaultLang).
Attributes
- Returns
-
a stub Langs
- Inherited from:
- StubMessagesFactory
Stub method that returns a play.api.i18n.Messages instance.
Stub method that returns a play.api.i18n.Messages instance.
Value parameters
- messagesApi
-
the messagesApi to use, uses stubMessagesApi by default.
- requestHeader
-
the request to use, FakeRequest by default.
Attributes
- Returns
-
the Messages instance
- Inherited from:
- StubMessagesFactory
Returns a stub DefaultMessagesApi with default values and an empty map.
Returns a stub DefaultMessagesApi with default values and an empty map.
Value parameters
- httpConfiguration
-
configuration, HttpConfiguration() by default.
- langCookieHttpOnly
-
false by default
- langCookieMaxAge
-
None by default
- langCookieName
-
"PLAY_LANG" by default
- langCookieSameSite
-
None by default
- langCookieSecure
-
false by default
- langs
-
stubLangs() by default
- messages
-
map of languages to map of messages, empty by default.
Attributes
- Returns
-
the messagesApi with minimal configuration.
- Inherited from:
- StubMessagesFactory
Stub method that returns a play.api.mvc.MessagesRequest instance.
Stub method that returns a play.api.mvc.MessagesRequest instance.
Value parameters
- messagesApi
-
the messagesApi to use, uses stubMessagesApi by default.
- request
-
the request to use, FakeRequest by default.
Attributes
- Returns
-
the Messages instance
- Inherited from:
- StubMessagesFactory
Stub method for unit testing, using NoTemporaryFileCreator.
Stub method for unit testing, using NoTemporaryFileCreator.
Value parameters
- mat
-
the input materializer.
Attributes
- Returns
-
a minimal PlayBodyParsers for unit testing.
- Inherited from:
- StubPlayBodyParsersFactory