Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
simple_string_submit example
public
function
testExecuteSubmitHandlers
(
)
{
$form_submitter
=
$this
->
getFormSubmitter
(
)
;
$mock
=
$this
->
prophesize
(
MockFormBase::
class
)
;
$mock
->
hash_submit
(
Argument::
type
(
'array'
)
, Argument::
type
(
FormStateInterface::
class
)
)
->
shouldBeCalledOnce
(
)
;
$mock
->
submit_handler
(
Argument::
type
(
'array'
)
, Argument::
type
(
FormStateInterface::
class
)
)
->
shouldBeCalledOnce
(
)
;
$mock
->
simple_string_submit
(
Argument::
type
(
'array'
)
, Argument::
type
(
FormStateInterface::
class
)
)
->
shouldBeCalledOnce
(
)
;
$form
=
[
]
;
$form_state
=
new
FormState
(
)
;
$form_submitter
->
executeSubmitHandlers
(
$form
,
$form_state
)
;
$form
[
'#submit'
]
[
]
=
[
$mock
->
reveal
(
)
, 'hash_submit'
]
;
$form_submitter
->
executeSubmitHandlers
(
$form
,
$form_state
)
;
// $form_state submit handlers will supersede $form handlers.
$form_state
->
setSubmitHandlers
(
[
[
$mock
->
reveal
(
)
, 'submit_handler'
]
]
)
;